Merge core project into winui project.
@@ -17,11 +17,11 @@ public class ProviderDetail : IProviderDetail
|
|||||||
{
|
{
|
||||||
if (SpecialImapProvider == SpecialImapProvider.None)
|
if (SpecialImapProvider == SpecialImapProvider.None)
|
||||||
{
|
{
|
||||||
return $"/Wino.Core.WinUI/Assets/Providers/{Type}.png";
|
return $"/Assets/Providers/{Type}.png";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $"/Wino.Core.WinUI/Assets/Providers/{SpecialImapProvider}.png";
|
return $"/Assets/Providers/{SpecialImapProvider}.png";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
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<T> : 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Windows.ApplicationModel.Activation;
|
using Windows.ApplicationModel.Activation;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="using:Wino.Mail.WinUI"
|
xmlns:local="using:Wino.Mail.WinUI"
|
||||||
xmlns:styles="using:Wino.Styles"
|
xmlns:styles="using:Wino.Styles"
|
||||||
xmlns:uwp="using:Wino.Core.WinUI">
|
xmlns:uwp="using:Wino.Mail.WinUI">
|
||||||
<uwp:WinoApplication.Resources>
|
<uwp:WinoApplication.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<ResourceDictionary Source="Controls/ListView/WinoListViewStyles.xaml" />
|
<ResourceDictionary Source="Controls/ListView/WinoListViewStyles.xaml" />
|
||||||
|
|
||||||
<styles:WinoExpanderStyle />
|
<styles:WinoExpanderStyle />
|
||||||
<ResourceDictionary Source="/Wino.Core.WinUI/AppThemes/Default.xaml" />
|
<ResourceDictionary Source="AppThemes/Default.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</uwp:WinoApplication.Resources>
|
</uwp:WinoApplication.Resources>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -13,8 +13,8 @@ using Wino.Core.Domain.Enums;
|
|||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.Domain.Models.MailItem;
|
using Wino.Core.Domain.Models.MailItem;
|
||||||
using Wino.Core.Domain.Models.Synchronization;
|
using Wino.Core.Domain.Models.Synchronization;
|
||||||
using Wino.Core.WinUI;
|
using Wino.Mail.WinUI;
|
||||||
using Wino.Core.WinUI.Interfaces;
|
using Wino.Mail.WinUI.Interfaces;
|
||||||
using Wino.Mail.Services;
|
using Wino.Mail.Services;
|
||||||
using Wino.Mail.ViewModels;
|
using Wino.Mail.ViewModels;
|
||||||
using Wino.Messaging.Client.Accounts;
|
using Wino.Messaging.Client.Accounts;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<abstract:AppShellAbstract
|
<abstract:AppShellAbstract
|
||||||
x:Class="Wino.Views.AppShell"
|
x:Class="Wino.Views.AppShell"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
xmlns:animations="using:CommunityToolkit.WinUI.Animations"
|
xmlns:animations="using:CommunityToolkit.WinUI.Animations"
|
||||||
xmlns:controls="using:Wino.Controls"
|
xmlns:controls="using:Wino.Controls"
|
||||||
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
||||||
xmlns:coreControls="using:Wino.Core.WinUI.Controls"
|
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||||
xmlns:coreConverters="using:Wino.Core.WinUI.Converters"
|
xmlns:coreConverters="using:Wino.Mail.WinUI.Converters"
|
||||||
xmlns:coreSelectors="using:Wino.Core.WinUI.Selectors"
|
xmlns:coreSelectors="using:Wino.Mail.WinUI.Selectors"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
xmlns:enums="using:Wino.Core.Domain.Enums"
|
xmlns:enums="using:Wino.Core.Domain.Enums"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -18,8 +18,8 @@ using Wino.Core.Domain.Interfaces;
|
|||||||
using Wino.Core.Domain.Models.Folders;
|
using Wino.Core.Domain.Models.Folders;
|
||||||
using Wino.Core.Domain.Models.MailItem;
|
using Wino.Core.Domain.Models.MailItem;
|
||||||
using Wino.Core.Domain.Models.Navigation;
|
using Wino.Core.Domain.Models.Navigation;
|
||||||
using Wino.Core.WinUI;
|
using Wino.Mail.WinUI;
|
||||||
using Wino.Core.WinUI.Controls;
|
using Wino.Mail.WinUI.Controls;
|
||||||
using Wino.Extensions;
|
using Wino.Extensions;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
using Wino.MenuFlyouts;
|
using Wino.MenuFlyouts;
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:local="using:Microsoft.UI.Xaml.Media"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Acrylic</x:String>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<!-- Acrylic Template -->
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<!-- Reading Page Date/Name Group Header Background -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#ecf0f1</SolidColorBrush>
|
||||||
|
|
||||||
|
<local:AcrylicBrush
|
||||||
|
x:Key="WinoApplicationBackgroundColor"
|
||||||
|
FallbackColor="#F9F9F9"
|
||||||
|
TintColor="#FCFCFC"
|
||||||
|
TintOpacity="0.75" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#2C2C2C</SolidColorBrush>
|
||||||
|
|
||||||
|
<local:AcrylicBrush
|
||||||
|
x:Key="WinoApplicationBackgroundColor"
|
||||||
|
FallbackColor="#2C2C2C"
|
||||||
|
TintColor="#2C2C2C"
|
||||||
|
TintOpacity="0.30" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Clouds</x:String>
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appx:///Wino.Mail.WinUI/BackgroundImages/Clouds.jpg</x:String>
|
||||||
|
|
||||||
|
<ImageBrush x:Key="WinoApplicationBackgroundColor" ImageSource="{StaticResource ThemeBackgroundImage}" />
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#b2dffc</SolidColorBrush>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="CalendarSeperatorBrush">#222f3e</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#b2dffc</SolidColorBrush>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="CalendarSeperatorBrush">#222f3e</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Custom</x:String>
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appdata:///local/CustomWallpaper.jpg</x:String>
|
||||||
|
|
||||||
|
<ImageBrush
|
||||||
|
x:Key="WinoApplicationBackgroundColor"
|
||||||
|
ImageSource="{StaticResource ThemeBackgroundImage}"
|
||||||
|
Stretch="UniformToFill" />
|
||||||
|
|
||||||
|
<!-- Navigation View Settings -->
|
||||||
|
<xaml:CornerRadius x:Key="NavigationViewContentGridCornerRadius">0,0,0,0</xaml:CornerRadius>
|
||||||
|
<xaml:CornerRadius x:Key="OverlayCornerRadius">0,1,0,0</xaml:CornerRadius>
|
||||||
|
<Thickness x:Key="NavigationViewContentMargin">0,0,0,0</Thickness>
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<!-- Reading Page Date/Name Group Header Background -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#ecf0f1</SolidColorBrush>
|
||||||
|
|
||||||
|
<Color x:Key="MainCustomThemeColor">#D9FFFFFF</Color>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor" Color="{StaticResource MainCustomThemeColor}" />
|
||||||
|
<SolidColorBrush x:Key="NavigationViewContentBackground" Color="Transparent" />
|
||||||
|
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{StaticResource MainCustomThemeColor}" />
|
||||||
|
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="{StaticResource MainCustomThemeColor}" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<!-- Reading Page Date/Name Group Header Background -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#1f1f1f</SolidColorBrush>
|
||||||
|
|
||||||
|
<Color x:Key="MainCustomThemeColor">#E61F1F1F</Color>
|
||||||
|
|
||||||
|
<!-- Reading Pane Background -->
|
||||||
|
<SolidColorBrush x:Key="ReadingPaneBackgroundColorBrush" Color="{StaticResource MainCustomThemeColor}" />
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor" Color="{StaticResource MainCustomThemeColor}" />
|
||||||
|
<SolidColorBrush x:Key="NavigationViewContentBackground" Color="Transparent" />
|
||||||
|
<SolidColorBrush x:Key="NavigationViewExpandedPaneBackground" Color="{StaticResource MainCustomThemeColor}" />
|
||||||
|
<SolidColorBrush x:Key="NavigationViewDefaultPaneBackground" Color="{StaticResource MainCustomThemeColor}" />
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Default</x:String>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="WinoApplicationBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<!-- Mica Template -->
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<!-- Reading Page Date/Name Group Header Background -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#ecf0f1</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#1f1f1f</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Forest</x:String>
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appx:///Wino.Mail.WinUI/BackgroundImages/Forest.jpg</x:String>
|
||||||
|
|
||||||
|
<ImageBrush x:Key="WinoApplicationBackgroundColor" ImageSource="{StaticResource ThemeBackgroundImage}" />
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#A800D608</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#59001C01</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Garden</x:String>
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appx:///Wino.Mail.WinUI/BackgroundImages/Garden.jpg</x:String>
|
||||||
|
|
||||||
|
<ImageBrush x:Key="WinoApplicationBackgroundColor" ImageSource="{StaticResource ThemeBackgroundImage}" />
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#dcfad8</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="CalendarSeperatorBrush">#576574</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
|
<!-- N/A. Light theme only. -->
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#dcfad8</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Nighty</x:String>
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appx:///Wino.Mail.WinUI/BackgroundImages/Nighty.jpg</x:String>
|
||||||
|
|
||||||
|
<ImageBrush x:Key="WinoApplicationBackgroundColor" ImageSource="{StaticResource ThemeBackgroundImage}" />
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<!-- Brushes -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#fdcb6e</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<!-- Brushes -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#5413191F</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<ResourceDictionary
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:xaml="using:Microsoft.UI.Xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">Snowflake</x:String>
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appx:///Wino.Mail.WinUI/BackgroundImages/Snowflake.jpg</x:String>
|
||||||
|
|
||||||
|
<ImageBrush x:Key="WinoApplicationBackgroundColor" ImageSource="{StaticResource ThemeBackgroundImage}" />
|
||||||
|
<SolidColorBrush x:Key="AppBarBackgroundColor">Transparent</SolidColorBrush>
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<!-- Brushes -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#b0c6dd</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<!-- Brushes -->
|
||||||
|
<SolidColorBrush x:Key="MailListHeaderBackgroundColor">#b0c6dd</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
|
<x:String x:Key="ThemeName">TestTheme.xaml</x:String>
|
||||||
|
|
||||||
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
|
<ResourceDictionary x:Name="Light">
|
||||||
|
<!-- Background Image -->
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appx:///BackgroundImages/bg6.jpg</x:String>
|
||||||
|
<SolidColorBrush x:Key="ShellTitleBarBackgroundColorBrush">#A3FFFFFF</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="ShellNavigationViewBackgroundColorBrush">#A3FFFFFF</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="ReadingPaneBackgroundColorBrush">#fdcb6e</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
<ResourceDictionary x:Name="Dark">
|
||||||
|
<!-- Background Image -->
|
||||||
|
<x:String x:Key="ThemeBackgroundImage">ms-appx:///BackgroundImages/bg6.jpg</x:String>
|
||||||
|
|
||||||
|
<SolidColorBrush x:Key="ShellTitleBarBackgroundColorBrush">#A3000000</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="ShellNavigationViewBackgroundColorBrush">#A3000000</SolidColorBrush>
|
||||||
|
<SolidColorBrush x:Key="ReadingPaneBackgroundColorBrush">#A3262626</SolidColorBrush>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
After Width: | Height: | Size: 348 B |
|
After Width: | Height: | Size: 504 B |
|
After Width: | Height: | Size: 678 B |
|
After Width: | Height: | Size: 591 B |
|
After Width: | Height: | Size: 599 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 256 B |
|
After Width: | Height: | Size: 712 B |
|
After Width: | Height: | Size: 621 B |
|
After Width: | Height: | Size: 413 B |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 122 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 90 KiB |
|
After Width: | Height: | Size: 962 KiB |
|
After Width: | Height: | Size: 80 KiB |
@@ -0,0 +1,96 @@
|
|||||||
|
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;
|
||||||
|
using WinoNavigationMode = Wino.Core.Domain.Models.Navigation.NavigationMode;
|
||||||
|
|
||||||
|
namespace Wino.Mail.WinUI;
|
||||||
|
|
||||||
|
public partial class BasePage : Page, IRecipient<LanguageChanged>
|
||||||
|
{
|
||||||
|
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() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Register message recipients for this page. Override to register specific message types.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void RegisterRecipients() { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unregister message recipients for this page. Override to unregister specific message types.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void UnregisterRecipients() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class BasePage<T> : BasePage where T : CoreBaseViewModel
|
||||||
|
{
|
||||||
|
public T ViewModel { get; } = WinoApplication.Current.Services.GetService<T>();
|
||||||
|
|
||||||
|
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<LanguageChanged>(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<LanguageChanged>(this);
|
||||||
|
UnregisterRecipients();
|
||||||
|
|
||||||
|
ViewModel.OnNavigatedFrom(mode, parameter);
|
||||||
|
|
||||||
|
GC.Collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
private WinoNavigationMode GetNavigationMode(NavigationMode mode)
|
||||||
|
{
|
||||||
|
return (WinoNavigationMode)mode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using CommunityToolkit.WinUI;
|
using CommunityToolkit.WinUI;
|
||||||
@@ -9,7 +9,7 @@ using Microsoft.UI.Xaml.Controls.Primitives;
|
|||||||
using Microsoft.Xaml.Interactivity;
|
using Microsoft.Xaml.Interactivity;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.Domain.Models.Menus;
|
using Wino.Core.Domain.Models.Menus;
|
||||||
using Wino.Core.WinUI.Controls;
|
using Wino.Mail.WinUI.Controls;
|
||||||
using Wino.Helpers;
|
using Wino.Helpers;
|
||||||
using Wino.Mail.WinUI;
|
using Wino.Mail.WinUI;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using Microsoft.Xaml.Interactivity;
|
using Microsoft.Xaml.Interactivity;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.WinUI.Controls;
|
using Wino.Mail.WinUI.Controls;
|
||||||
|
|
||||||
namespace Wino.Behaviors;
|
namespace Wino.Behaviors;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
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.Mail.WinUI.Controls;
|
||||||
|
|
||||||
|
public sealed partial class AccountCreationDialogControl : UserControl, IRecipient<CopyAuthURLRequested>
|
||||||
|
{
|
||||||
|
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<IClipboardService>();
|
||||||
|
await clipboardService.CopyClipboardAsync(copyClipboardURL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CancelButtonClicked(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) => CancelClicked?.Invoke(this, null);
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.WinUI.Controls;
|
using Wino.Mail.WinUI.Controls;
|
||||||
|
|
||||||
namespace Wino.Controls;
|
namespace Wino.Controls;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using CommunityToolkit.WinUI;
|
using CommunityToolkit.WinUI;
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Wino.Mail.WinUI.Controls;
|
||||||
|
|
||||||
|
public static class ControlConstants
|
||||||
|
{
|
||||||
|
public static Dictionary<WinoIconGlyph, string> WinoIconFontDictionary = new Dictionary<WinoIconGlyph, string>()
|
||||||
|
{
|
||||||
|
{ 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" }
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Wino.Mail.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
using Windows.Foundation;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace Wino.Mail.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using CommunityToolkit.WinUI;
|
using CommunityToolkit.WinUI;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CommunityToolkit.WinUI;
|
using CommunityToolkit.WinUI;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Controls;
|
using Wino.Controls;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Wino.Controls.MailItemDisplayInformationControl"
|
x:Class="Wino.Controls.MailItemDisplayInformationControl"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
|
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
|
||||||
xmlns:controls="using:Wino.Controls"
|
xmlns:controls="using:Wino.Controls"
|
||||||
xmlns:coreControls="using:Wino.Core.WinUI.Controls"
|
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
xmlns:enums="using:Wino.Core.Domain.Enums"
|
xmlns:enums="using:Wino.Core.Domain.Enums"
|
||||||
xmlns:helpers="using:Wino.Helpers"
|
xmlns:helpers="using:Wino.Helpers"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -12,7 +12,7 @@ using Wino.Core.Domain;
|
|||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.Domain.Models;
|
using Wino.Core.Domain.Models;
|
||||||
using Wino.Core.Domain.Models.Reader;
|
using Wino.Core.Domain.Models.Reader;
|
||||||
using Wino.Core.WinUI.Extensions;
|
using Wino.Mail.WinUI.Extensions;
|
||||||
using Wino.Mail.WinUI;
|
using Wino.Mail.WinUI;
|
||||||
|
|
||||||
namespace Wino.Mail.Controls;
|
namespace Wino.Mail.Controls;
|
||||||
@@ -139,7 +139,7 @@ public sealed partial class WebViewEditorControl : Control, IDisposable
|
|||||||
{
|
{
|
||||||
this.DefaultStyleKey = typeof(WebViewEditorControl);
|
this.DefaultStyleKey = typeof(WebViewEditorControl);
|
||||||
|
|
||||||
IsEditorDarkMode = Core.WinUI.WinoApplication.Current.UnderlyingThemeService.IsUnderlyingThemeDark();
|
IsEditorDarkMode = WinoApplication.Current.UnderlyingThemeService.IsUnderlyingThemeDark();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async void OnApplyTemplate()
|
protected override async void OnApplyTemplate()
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using CommunityToolkit.Diagnostics;
|
using CommunityToolkit.Diagnostics;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Microsoft.UI.Xaml.Hosting;
|
using Microsoft.UI.Xaml.Hosting;
|
||||||
|
|||||||
@@ -0,0 +1,135 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|
||||||
|
namespace Wino.Mail.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("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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Wino.Mail.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];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
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.Mail.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Hosting;
|
||||||
|
|
||||||
|
namespace Wino.Mail.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Core.Domain.Enums;
|
using Wino.Core.Domain.Enums;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Core.WinUI;
|
using Wino.Mail.WinUI;
|
||||||
using Wino.Helpers;
|
using Wino.Helpers;
|
||||||
using Wino.Mail.ViewModels.Data;
|
using Wino.Mail.ViewModels.Data;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
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.Mail.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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ResourceDictionary
|
||||||
|
x:Class="Wino.Mail.WinUI.CoreGeneric"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||||
|
xmlns:styles="using:Wino.Mail.WinUI.Styles">
|
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||||
|
|
||||||
|
<ResourceDictionary Source="Styles/Colors.xaml" />
|
||||||
|
<ResourceDictionary Source="Styles/ContentPresenters.xaml" />
|
||||||
|
<ResourceDictionary Source="Styles/Converters.xaml" />
|
||||||
|
<ResourceDictionary Source="Styles/FontIcons.xaml" />
|
||||||
|
<ResourceDictionary Source="Styles/WinoInfoBar.xaml" />
|
||||||
|
<ResourceDictionary Source="Styles/SharedStyles.xaml" />
|
||||||
|
<ResourceDictionary Source="Styles/IconTemplates.xaml" />
|
||||||
|
|
||||||
|
<styles:CustomMessageDialogStyles />
|
||||||
|
<styles:DataTemplates />
|
||||||
|
|
||||||
|
<ResourceDictionary>
|
||||||
|
<Style TargetType="ScrollViewer">
|
||||||
|
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Remove border/backgroud of command bar -->
|
||||||
|
<SolidColorBrush x:Key="CommandBarBackground" Color="Transparent" />
|
||||||
|
<SolidColorBrush x:Key="CommandBarBackgroundOpen" Color="Transparent" />
|
||||||
|
<SolidColorBrush x:Key="CommandBarBorderBrushOpen" Color="Transparent" />
|
||||||
|
<Thickness x:Key="CommandBarBorderThicknessOpen">0</Thickness>
|
||||||
|
|
||||||
|
<!-- Override AppBarToggleButton's checked background color. -->
|
||||||
|
<StaticResource x:Key="AppBarToggleButtonBackgroundChecked" ResourceKey="SystemAccentColor" />
|
||||||
|
<StaticResource x:Key="AppBarToggleButtonBackgroundCheckedPointerOver" ResourceKey="SystemAccentColor" />
|
||||||
|
<StaticResource x:Key="AppBarToggleButtonBackgroundCheckedPressed" ResourceKey="SystemAccentColor" />
|
||||||
|
|
||||||
|
<Thickness x:Key="ImapSetupDialogSubPagePadding">24,24,24,24</Thickness>
|
||||||
|
|
||||||
|
<!-- Border style for each page's root border for separation of zones. -->
|
||||||
|
<Style x:Key="PageRootBorderStyle" TargetType="Border">
|
||||||
|
<Setter Property="Background" Value="{ThemeResource WinoContentZoneBackgroud}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource CardStrokeColorDefaultBrush}" />
|
||||||
|
<Setter Property="CornerRadius" Value="7" />
|
||||||
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Custom Grid style for info panels. -->
|
||||||
|
<Style x:Key="InformationAreaGridStyle" TargetType="Grid">
|
||||||
|
<Setter Property="Background" Value="{ThemeResource CardBackgroundFillColorDefaultBrush}" />
|
||||||
|
<Setter Property="BorderBrush" Value="{ThemeResource DividerStrokeColorDefaultBrush}" />
|
||||||
|
<Setter Property="CornerRadius" Value="8" />
|
||||||
|
<Setter Property="Padding" Value="16" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Default StackPanel animation. -->
|
||||||
|
<Style TargetType="StackPanel">
|
||||||
|
<Setter Property="ChildrenTransitions">
|
||||||
|
<Setter.Value>
|
||||||
|
<TransitionCollection>
|
||||||
|
<EntranceThemeTransition IsStaggeringEnabled="False" />
|
||||||
|
</TransitionCollection>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Default Style for ContentDialog -->
|
||||||
|
<Style
|
||||||
|
x:Key="WinoDialogStyle"
|
||||||
|
BasedOn="{StaticResource DefaultContentDialogStyle}"
|
||||||
|
TargetType="ContentDialog" />
|
||||||
|
|
||||||
|
<!-- Wino Navigation View Item -->
|
||||||
|
<Style TargetType="coreControls:WinoNavigationViewItem">
|
||||||
|
<Setter Property="ContentTransitions">
|
||||||
|
<Setter.Value>
|
||||||
|
<TransitionCollection>
|
||||||
|
<PopupThemeTransition />
|
||||||
|
</TransitionCollection>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="PageStyle" TargetType="Page">
|
||||||
|
<Setter Property="Margin" Value="-1,0,0,0" />
|
||||||
|
<Setter Property="Padding" Value="12" />
|
||||||
|
<Setter Property="Background" Value="{ThemeResource AppBarBackgroundColor}" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<Grid Padding="12">
|
||||||
|
<ContentPresenter />
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- Spacing between cards -->
|
||||||
|
<x:Double x:Key="SettingsCardSpacing">4</x:Double>
|
||||||
|
|
||||||
|
<!-- Style (inc. the correct spacing) of a section header -->
|
||||||
|
<Style
|
||||||
|
x:Key="SettingsSectionHeaderTextBlockStyle"
|
||||||
|
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
|
||||||
|
TargetType="TextBlock">
|
||||||
|
<Style.Setters>
|
||||||
|
<Setter Property="Margin" Value="1,30,0,6" />
|
||||||
|
</Style.Setters>
|
||||||
|
</Style>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
|
||||||
|
namespace Wino.Mail.WinUI;
|
||||||
|
|
||||||
|
public partial class CoreGeneric : ResourceDictionary
|
||||||
|
{
|
||||||
|
public CoreGeneric() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Wino.Core.Domain.Interfaces;
|
||||||
|
using Wino.Core.ViewModels;
|
||||||
|
using Wino.Mail.WinUI.Services;
|
||||||
|
using Wino.Services;
|
||||||
|
|
||||||
|
namespace Wino.Mail.WinUI;
|
||||||
|
|
||||||
|
public static class CoreUWPContainerSetup
|
||||||
|
{
|
||||||
|
public static void RegisterCoreUWPServices(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddSingleton<IApplicationResourceManager<ResourceDictionary>, ApplicationResourceManager>();
|
||||||
|
|
||||||
|
services.AddSingleton<IUnderlyingThemeService, UnderlyingThemeService>();
|
||||||
|
services.AddSingleton<INativeAppService, NativeAppService>();
|
||||||
|
services.AddSingleton<IStoreManagementService, StoreManagementService>();
|
||||||
|
services.AddSingleton<IPreferencesService, PreferencesService>();
|
||||||
|
services.AddSingleton<INewThemeService, NewThemeService>();
|
||||||
|
services.AddSingleton<IStatePersistanceService, StatePersistenceService>();
|
||||||
|
services.AddSingleton<IThumbnailService, ThumbnailService>();
|
||||||
|
services.AddSingleton<IDialogServiceBase, DialogServiceBase>();
|
||||||
|
services.AddTransient<IConfigurationService, ConfigurationService>();
|
||||||
|
services.AddTransient<IFileService, FileService>();
|
||||||
|
services.AddTransient<IStoreRatingService, StoreRatingService>();
|
||||||
|
services.AddTransient<IKeyPressService, KeyPressService>();
|
||||||
|
services.AddTransient<INotificationBuilder, NotificationBuilder>();
|
||||||
|
services.AddTransient<IClipboardService, ClipboardService>();
|
||||||
|
services.AddTransient<IStartupBehaviorService, StartupBehaviorService>();
|
||||||
|
services.AddSingleton<IPrintService, PrintService>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<ContentDialog
|
||||||
|
x:Class="Wino.Dialogs.AccountCreationDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="using:Wino.Mail.WinUI.Controls"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:dialogs="using:Wino.Dialogs"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
Closing="DialogClosing"
|
||||||
|
CornerRadius="8"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<!-- ContentDialogs do not support VSM. -->
|
||||||
|
|
||||||
|
<controls:AccountCreationDialogControl
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
CancelClicked="CancelClicked"
|
||||||
|
State="{x:Bind State, Mode=OneWay}" />
|
||||||
|
|
||||||
|
</ContentDialog>
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
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<bool> dialogOpened = new TaskCompletionSource<bool>();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<ContentDialog
|
||||||
|
x:Class="Wino.Dialogs.AccountPickerDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
Title="{x:Bind domain:Translator.AccountPickerDialog_Title}"
|
||||||
|
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
|
||||||
|
Style="{StaticResource WinoDialogStyle}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
DisplayMemberPath="Address"
|
||||||
|
IsItemClickEnabled="True"
|
||||||
|
ItemClick="AccountClicked"
|
||||||
|
ItemsSource="{x:Bind AvailableAccounts}"
|
||||||
|
SelectionMode="None" />
|
||||||
|
</ContentDialog>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
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<MailAccount> AvailableAccounts { get; set; }
|
||||||
|
|
||||||
|
public AccountPickerDialog(List<MailAccount> availableAccounts)
|
||||||
|
{
|
||||||
|
AvailableAccounts = availableAccounts;
|
||||||
|
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AccountClicked(object sender, ItemClickEventArgs e)
|
||||||
|
{
|
||||||
|
PickedAccount = e.ClickedItem as MailAccount;
|
||||||
|
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Wino.Dialogs.AccountReorderDialog"
|
x:Class="Wino.Dialogs.AccountReorderDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="using:Wino.Controls"
|
xmlns:controls="using:Wino.Controls"
|
||||||
xmlns:coreControls="using:Wino.Core.WinUI.Controls"
|
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
xmlns:helpers="using:Wino.Helpers"
|
xmlns:helpers="using:Wino.Helpers"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Wino.Dialogs.CreateAccountAliasDialog"
|
x:Class="Wino.Dialogs.CreateAccountAliasDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Core.Domain.Entities.Mail;
|
using Wino.Core.Domain.Entities.Mail;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<ContentDialog
|
||||||
|
x:Class="Wino.Dialogs.CustomThemeBuilderDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
|
xmlns:local="using:Wino.Dialogs"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||||
|
Title="{x:Bind domain:Translator.CustomThemeBuilder_Title}"
|
||||||
|
DefaultButton="Primary"
|
||||||
|
FullSizeDesired="False"
|
||||||
|
IsPrimaryButtonEnabled="False"
|
||||||
|
PrimaryButtonClick="ApplyClicked"
|
||||||
|
PrimaryButtonText="{x:Bind domain:Translator.Buttons_ApplyTheme}"
|
||||||
|
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
|
||||||
|
Style="{StaticResource WinoDialogStyle}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<ContentDialog.Resources>
|
||||||
|
<x:Double x:Key="ContentDialogMinWidth">600</x:Double>
|
||||||
|
<x:Double x:Key="ContentDialogMaxWidth">900</x:Double>
|
||||||
|
<x:Double x:Key="ContentDialogMinHeight">200</x:Double>
|
||||||
|
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>
|
||||||
|
</ContentDialog.Resources>
|
||||||
|
|
||||||
|
<StackPanel Spacing="6">
|
||||||
|
<TextBlock x:Name="ErrorTextBlock" Foreground="Gold" />
|
||||||
|
|
||||||
|
<controls:SettingsCard Description="{x:Bind domain:Translator.CustomThemeBuilder_ThemeNameDescription}" Header="{x:Bind domain:Translator.CustomThemeBuilder_ThemeNameTitle}">
|
||||||
|
<controls:SettingsCard.HeaderIcon>
|
||||||
|
<PathIcon Data="F1 M 10 0.625 C 10 0.45573 10.061849 0.309246 10.185547 0.185547 C 10.309244 0.06185 10.455729 0 10.625 0 L 15.625 0 C 15.79427 0 15.940754 0.06185 16.064453 0.185547 C 16.18815 0.309246 16.25 0.45573 16.25 0.625 C 16.25 0.794271 16.18815 0.940756 16.064453 1.064453 C 15.940754 1.188152 15.79427 1.25 15.625 1.25 L 13.75 1.25 L 13.75 18.75 L 15.625 18.75 C 15.79427 18.75 15.940754 18.81185 16.064453 18.935547 C 16.18815 19.059244 16.25 19.205729 16.25 19.375 C 16.25 19.544271 16.18815 19.690756 16.064453 19.814453 C 15.940754 19.93815 15.79427 20 15.625 20 L 10.625 20 C 10.455729 20 10.309244 19.93815 10.185547 19.814453 C 10.061849 19.690756 10 19.544271 10 19.375 C 10 19.205729 10.061849 19.059244 10.185547 18.935547 C 10.309244 18.81185 10.455729 18.75 10.625 18.75 L 12.5 18.75 L 12.5 1.25 L 10.625 1.25 C 10.455729 1.25 10.309244 1.188152 10.185547 1.064453 C 10.061849 0.940756 10 0.794271 10 0.625 Z M 0 6.25 C 0 5.735678 0.097656 5.250651 0.292969 4.794922 C 0.488281 4.339193 0.756836 3.94043 1.098633 3.598633 C 1.44043 3.256836 1.837565 2.988281 2.290039 2.792969 C 2.742513 2.597656 3.229167 2.5 3.75 2.5 L 11.25 2.5 L 11.25 3.75 L 3.75 3.75 C 3.404948 3.75 3.081055 3.815105 2.77832 3.945312 C 2.475586 4.075521 2.210286 4.254558 1.982422 4.482422 C 1.754557 4.710287 1.575521 4.975587 1.445312 5.27832 C 1.315104 5.581056 1.25 5.904949 1.25 6.25 L 1.25 13.75 C 1.25 14.095053 1.315104 14.418945 1.445312 14.72168 C 1.575521 15.024414 1.754557 15.289714 1.982422 15.517578 C 2.210286 15.745443 2.475586 15.924479 2.77832 16.054688 C 3.081055 16.184896 3.404948 16.25 3.75 16.25 L 11.25 16.25 L 11.25 17.5 L 3.75 17.5 C 3.229167 17.5 2.742513 17.402344 2.290039 17.207031 C 1.837565 17.011719 1.44043 16.743164 1.098633 16.401367 C 0.756836 16.05957 0.488281 15.662436 0.292969 15.209961 C 0.097656 14.757487 0 14.270834 0 13.75 Z M 15 3.75 L 15 2.5 L 16.25 2.5 C 16.764322 2.5 17.249348 2.597656 17.705078 2.792969 C 18.160807 2.988281 18.55957 3.256836 18.901367 3.598633 C 19.243164 3.94043 19.511719 4.339193 19.707031 4.794922 C 19.902344 5.250651 20 5.735678 20 6.25 L 20 13.75 C 20 14.270834 19.902344 14.757487 19.707031 15.209961 C 19.511719 15.662436 19.243164 16.05957 18.901367 16.401367 C 18.55957 16.743164 18.160807 17.011719 17.705078 17.207031 C 17.249348 17.402344 16.764322 17.5 16.25 17.5 L 15 17.5 L 15 16.25 L 16.25 16.25 C 16.595051 16.25 16.918945 16.184896 17.22168 16.054688 C 17.524414 15.924479 17.789713 15.745443 18.017578 15.517578 C 18.245441 15.289714 18.424479 15.024414 18.554688 14.72168 C 18.684895 14.418945 18.75 14.095053 18.75 13.75 L 18.75 6.25 C 18.75 5.904949 18.684895 5.581056 18.554688 5.27832 C 18.424479 4.975587 18.245441 4.710287 18.017578 4.482422 C 17.789713 4.254558 17.524414 4.075521 17.22168 3.945312 C 16.918945 3.815105 16.595051 3.75 16.25 3.75 Z M 7.441406 5.361328 C 7.389323 5.250651 7.312825 5.162761 7.211914 5.097656 C 7.111002 5.032553 6.998697 5.000001 6.875 5 C 6.751302 5.000001 6.638997 5.032553 6.538086 5.097656 C 6.437174 5.162761 6.360677 5.250651 6.308594 5.361328 L 2.871094 12.861328 C 2.799479 13.017578 2.792969 13.177084 2.851562 13.339844 C 2.910156 13.502604 3.017578 13.619792 3.173828 13.691406 C 3.330078 13.763021 3.489583 13.769531 3.652344 13.710938 C 3.815104 13.652344 3.932292 13.544922 4.003906 13.388672 L 4.84375 11.5625 L 8.896484 11.5625 L 8.90625 11.5625 L 9.746094 13.388672 C 9.817708 13.544922 9.934896 13.652344 10.097656 13.710938 C 10.260416 13.769531 10.419922 13.763021 10.576172 13.691406 C 10.732422 13.619792 10.839844 13.502604 10.898438 13.339844 C 10.957031 13.177084 10.950521 13.017578 10.878906 12.861328 Z M 5.410156 10.3125 L 6.875 7.128906 L 8.339844 10.3125 Z " />
|
||||||
|
</controls:SettingsCard.HeaderIcon>
|
||||||
|
<controls:SettingsCard.Content>
|
||||||
|
<TextBox x:Name="ThemeNameBox" />
|
||||||
|
</controls:SettingsCard.Content>
|
||||||
|
</controls:SettingsCard>
|
||||||
|
|
||||||
|
<controls:SettingsCard
|
||||||
|
x:Name="CustomWallpaperCard"
|
||||||
|
Description="{x:Bind domain:Translator.CustomThemeBuilder_WallpaperDescription}"
|
||||||
|
Header="{x:Bind domain:Translator.CustomThemeBuilder_WallpaperTitle}">
|
||||||
|
<controls:SettingsCard.HeaderIcon>
|
||||||
|
<PathIcon Data="F1 M 4.921875 16.25 C 4.433594 16.25 3.966471 16.150717 3.520508 15.952148 C 3.074544 15.753581 2.683919 15.486654 2.348633 15.151367 C 2.013346 14.816081 1.746419 14.425456 1.547852 13.979492 C 1.349284 13.533529 1.25 13.066406 1.25 12.578125 L 1.25 4.921875 C 1.25 4.433594 1.349284 3.966473 1.547852 3.520508 C 1.746419 3.074545 2.013346 2.68392 2.348633 2.348633 C 2.683919 2.013348 3.074544 1.74642 3.520508 1.547852 C 3.966471 1.349285 4.433594 1.25 4.921875 1.25 L 12.578125 1.25 C 13.066406 1.25 13.533528 1.349285 13.979492 1.547852 C 14.425455 1.74642 14.81608 2.013348 15.151367 2.348633 C 15.486653 2.68392 15.75358 3.074545 15.952148 3.520508 C 16.150715 3.966473 16.25 4.433594 16.25 4.921875 L 16.25 12.578125 C 16.25 13.066406 16.150715 13.533529 15.952148 13.979492 C 15.75358 14.425456 15.486653 14.816081 15.151367 15.151367 C 14.81608 15.486654 14.425455 15.753581 13.979492 15.952148 C 13.533528 16.150717 13.066406 16.25 12.578125 16.25 Z M 8.75 8.90625 C 9.082031 8.90625 9.401041 8.969727 9.707031 9.09668 C 10.013021 9.223633 10.283203 9.404297 10.517578 9.638672 L 14.658203 13.769531 C 14.768879 13.580729 14.853515 13.377279 14.912109 13.15918 C 14.970702 12.941081 14.999999 12.721354 15 12.5 L 15 4.951172 C 14.999999 4.625651 14.933268 4.314779 14.799805 4.018555 C 14.666341 3.722332 14.487305 3.461914 14.262695 3.237305 C 14.038086 3.012695 13.777669 2.83366 13.481445 2.700195 C 13.185221 2.566732 12.874348 2.5 12.548828 2.5 L 4.951172 2.5 C 4.625651 2.5 4.314778 2.566732 4.018555 2.700195 C 3.722331 2.83366 3.461914 3.012695 3.237305 3.237305 C 3.012695 3.461914 2.833659 3.722332 2.700195 4.018555 C 2.566732 4.314779 2.5 4.625651 2.5 4.951172 L 2.5 12.5 C 2.5 12.721354 2.529297 12.941081 2.587891 13.15918 C 2.646484 13.377279 2.73112 13.580729 2.841797 13.769531 L 6.982422 9.638672 C 7.216797 9.404297 7.486979 9.223633 7.792969 9.09668 C 8.098958 8.969727 8.417969 8.90625 8.75 8.90625 Z M 10.625 5.625 C 10.625 5.449219 10.657552 5.286459 10.722656 5.136719 C 10.78776 4.98698 10.877278 4.855145 10.991211 4.741211 C 11.105143 4.627279 11.236979 4.537761 11.386719 4.472656 C 11.536458 4.407553 11.699219 4.375 11.875 4.375 C 12.04427 4.375 12.205402 4.407553 12.358398 4.472656 C 12.511393 4.537761 12.644856 4.627279 12.758789 4.741211 C 12.872721 4.855145 12.962239 4.988607 13.027344 5.141602 C 13.092447 5.294597 13.124999 5.455729 13.125 5.625 C 13.124999 5.800781 13.092447 5.963542 13.027344 6.113281 C 12.962239 6.263021 12.872721 6.394857 12.758789 6.508789 C 12.644856 6.622722 12.513021 6.71224 12.363281 6.777344 C 12.213541 6.842449 12.050781 6.875001 11.875 6.875 C 11.699219 6.875001 11.53483 6.842449 11.381836 6.777344 C 11.228841 6.71224 11.097005 6.62435 10.986328 6.513672 C 10.87565 6.402996 10.78776 6.27116 10.722656 6.118164 C 10.657552 5.96517 10.625 5.800781 10.625 5.625 Z M 7.5 18.75 C 6.966146 18.75 6.455078 18.642578 5.966797 18.427734 C 5.478516 18.212891 5.058594 17.903646 4.707031 17.5 L 13.193359 17.5 C 13.785807 17.5 14.344075 17.382812 14.868164 17.148438 C 15.392252 16.914062 15.849609 16.59668 16.240234 16.196289 C 16.630859 15.795898 16.938477 15.332031 17.163086 14.804688 C 17.387695 14.277344 17.5 13.717448 17.5 13.125 L 17.5 4.707031 C 17.903645 5.058595 18.212891 5.478517 18.427734 5.966797 C 18.642578 6.455079 18.75 6.966146 18.75 7.5 L 18.75 13.125 C 18.75 13.89974 18.601887 14.628906 18.305664 15.3125 C 18.009439 15.996094 17.607422 16.591797 17.099609 17.099609 C 16.591797 17.607422 15.996094 18.009439 15.3125 18.305664 C 14.628906 18.601889 13.899739 18.75 13.125 18.75 Z M 12.5 15 C 12.721354 15 12.94108 14.970703 13.15918 14.912109 C 13.377278 14.853516 13.580729 14.768881 13.769531 14.658203 L 9.638672 10.517578 C 9.391275 10.270183 9.095052 10.146484 8.75 10.146484 C 8.404947 10.146484 8.108724 10.270183 7.861328 10.517578 L 3.730469 14.658203 C 3.919271 14.768881 4.122721 14.853516 4.34082 14.912109 C 4.558919 14.970703 4.778646 15 5 15 Z " />
|
||||||
|
</controls:SettingsCard.HeaderIcon>
|
||||||
|
<controls:SettingsCard.Content>
|
||||||
|
<Button Click="BrowseWallpaperClicked" Content="{x:Bind domain:Translator.Buttons_Browse}" />
|
||||||
|
</controls:SettingsCard.Content>
|
||||||
|
</controls:SettingsCard>
|
||||||
|
|
||||||
|
<controls:SettingsCard Description="{x:Bind domain:Translator.CustomThemeBuilder_AccentColorDescription}" Header="{x:Bind domain:Translator.CustomThemeBuilder_AccentColorTitle}">
|
||||||
|
<controls:SettingsCard.HeaderIcon>
|
||||||
|
<PathIcon Data="F1 M 4.921875 16.25 C 4.433594 16.25 3.966471 16.150717 3.520508 15.952148 C 3.074544 15.753581 2.683919 15.486654 2.348633 15.151367 C 2.013346 14.816081 1.746419 14.425456 1.547852 13.979492 C 1.349284 13.533529 1.25 13.066406 1.25 12.578125 L 1.25 4.921875 C 1.25 4.433594 1.349284 3.966473 1.547852 3.520508 C 1.746419 3.074545 2.013346 2.68392 2.348633 2.348633 C 2.683919 2.013348 3.074544 1.74642 3.520508 1.547852 C 3.966471 1.349285 4.433594 1.25 4.921875 1.25 L 12.578125 1.25 C 13.066406 1.25 13.533528 1.349285 13.979492 1.547852 C 14.425455 1.74642 14.81608 2.013348 15.151367 2.348633 C 15.486653 2.68392 15.75358 3.074545 15.952148 3.520508 C 16.150715 3.966473 16.25 4.433594 16.25 4.921875 L 16.25 12.578125 C 16.25 13.066406 16.150715 13.533529 15.952148 13.979492 C 15.75358 14.425456 15.486653 14.816081 15.151367 15.151367 C 14.81608 15.486654 14.425455 15.753581 13.979492 15.952148 C 13.533528 16.150717 13.066406 16.25 12.578125 16.25 Z M 8.75 8.90625 C 9.082031 8.90625 9.401041 8.969727 9.707031 9.09668 C 10.013021 9.223633 10.283203 9.404297 10.517578 9.638672 L 14.658203 13.769531 C 14.768879 13.580729 14.853515 13.377279 14.912109 13.15918 C 14.970702 12.941081 14.999999 12.721354 15 12.5 L 15 4.951172 C 14.999999 4.625651 14.933268 4.314779 14.799805 4.018555 C 14.666341 3.722332 14.487305 3.461914 14.262695 3.237305 C 14.038086 3.012695 13.777669 2.83366 13.481445 2.700195 C 13.185221 2.566732 12.874348 2.5 12.548828 2.5 L 4.951172 2.5 C 4.625651 2.5 4.314778 2.566732 4.018555 2.700195 C 3.722331 2.83366 3.461914 3.012695 3.237305 3.237305 C 3.012695 3.461914 2.833659 3.722332 2.700195 4.018555 C 2.566732 4.314779 2.5 4.625651 2.5 4.951172 L 2.5 12.5 C 2.5 12.721354 2.529297 12.941081 2.587891 13.15918 C 2.646484 13.377279 2.73112 13.580729 2.841797 13.769531 L 6.982422 9.638672 C 7.216797 9.404297 7.486979 9.223633 7.792969 9.09668 C 8.098958 8.969727 8.417969 8.90625 8.75 8.90625 Z M 10.625 5.625 C 10.625 5.449219 10.657552 5.286459 10.722656 5.136719 C 10.78776 4.98698 10.877278 4.855145 10.991211 4.741211 C 11.105143 4.627279 11.236979 4.537761 11.386719 4.472656 C 11.536458 4.407553 11.699219 4.375 11.875 4.375 C 12.04427 4.375 12.205402 4.407553 12.358398 4.472656 C 12.511393 4.537761 12.644856 4.627279 12.758789 4.741211 C 12.872721 4.855145 12.962239 4.988607 13.027344 5.141602 C 13.092447 5.294597 13.124999 5.455729 13.125 5.625 C 13.124999 5.800781 13.092447 5.963542 13.027344 6.113281 C 12.962239 6.263021 12.872721 6.394857 12.758789 6.508789 C 12.644856 6.622722 12.513021 6.71224 12.363281 6.777344 C 12.213541 6.842449 12.050781 6.875001 11.875 6.875 C 11.699219 6.875001 11.53483 6.842449 11.381836 6.777344 C 11.228841 6.71224 11.097005 6.62435 10.986328 6.513672 C 10.87565 6.402996 10.78776 6.27116 10.722656 6.118164 C 10.657552 5.96517 10.625 5.800781 10.625 5.625 Z M 7.5 18.75 C 6.966146 18.75 6.455078 18.642578 5.966797 18.427734 C 5.478516 18.212891 5.058594 17.903646 4.707031 17.5 L 13.193359 17.5 C 13.785807 17.5 14.344075 17.382812 14.868164 17.148438 C 15.392252 16.914062 15.849609 16.59668 16.240234 16.196289 C 16.630859 15.795898 16.938477 15.332031 17.163086 14.804688 C 17.387695 14.277344 17.5 13.717448 17.5 13.125 L 17.5 4.707031 C 17.903645 5.058595 18.212891 5.478517 18.427734 5.966797 C 18.642578 6.455079 18.75 6.966146 18.75 7.5 L 18.75 13.125 C 18.75 13.89974 18.601887 14.628906 18.305664 15.3125 C 18.009439 15.996094 17.607422 16.591797 17.099609 17.099609 C 16.591797 17.607422 15.996094 18.009439 15.3125 18.305664 C 14.628906 18.601889 13.899739 18.75 13.125 18.75 Z M 12.5 15 C 12.721354 15 12.94108 14.970703 13.15918 14.912109 C 13.377278 14.853516 13.580729 14.768881 13.769531 14.658203 L 9.638672 10.517578 C 9.391275 10.270183 9.095052 10.146484 8.75 10.146484 C 8.404947 10.146484 8.108724 10.270183 7.861328 10.517578 L 3.730469 14.658203 C 3.919271 14.768881 4.122721 14.853516 4.34082 14.912109 C 4.558919 14.970703 4.778646 15 5 15 Z " />
|
||||||
|
</controls:SettingsCard.HeaderIcon>
|
||||||
|
<controls:SettingsCard.Content>
|
||||||
|
<Button>
|
||||||
|
<Button.Content>
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="12">
|
||||||
|
<TextBlock Text="{x:Bind domain:Translator.CustomThemeBuilder_PickColor}" />
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
x:Name="PreviewAccentColorGrid"
|
||||||
|
Width="20"
|
||||||
|
Height="20"
|
||||||
|
Background="{ThemeResource SystemAccentColor}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button.Content>
|
||||||
|
<Button.Flyout>
|
||||||
|
<Flyout Placement="Bottom">
|
||||||
|
<muxc:ColorPicker
|
||||||
|
ColorChanged="PickerColorChanged"
|
||||||
|
ColorSpectrumShape="Box"
|
||||||
|
IsAlphaEnabled="False"
|
||||||
|
IsAlphaSliderVisible="False"
|
||||||
|
IsAlphaTextInputVisible="False"
|
||||||
|
IsColorChannelTextInputVisible="False"
|
||||||
|
IsHexInputVisible="False" />
|
||||||
|
</Flyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
|
</controls:SettingsCard.Content>
|
||||||
|
</controls:SettingsCard>
|
||||||
|
</StackPanel>
|
||||||
|
</ContentDialog>
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
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.Mail.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<INewThemeService>();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void ApplyClicked(ContentDialog sender, ContentDialogButtonClickEventArgs args)
|
||||||
|
{
|
||||||
|
if (Array.Empty<byte>() == 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<IMailDialogService>();
|
||||||
|
|
||||||
|
var pickedFileData = await dialogService.PickWindowsFileContentAsync(".jpg", ".png");
|
||||||
|
|
||||||
|
if (pickedFileData == Array.Empty<byte>()) 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Wino.Mail.Dialogs.MessageSourceDialog"
|
x:Class="Wino.Mail.Dialogs.MessageSourceDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Core.Domain.Interfaces;
|
using Wino.Core.Domain.Interfaces;
|
||||||
using Wino.Mail.WinUI;
|
using Wino.Mail.WinUI;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Wino.Dialogs.MoveMailDialog"
|
x:Class="Wino.Dialogs.MoveMailDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="using:Wino.Controls"
|
xmlns:controls="using:Wino.Controls"
|
||||||
xmlns:coreControls="using:Wino.Core.WinUI.Controls"
|
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
xmlns:folders="using:Wino.Core.Domain.Models.Folders"
|
xmlns:folders="using:Wino.Core.Domain.Models.Folders"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.UI.Xaml;
|
using Microsoft.UI.Xaml;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
|
|||||||
@@ -0,0 +1,152 @@
|
|||||||
|
<ContentDialog
|
||||||
|
x:Class="Wino.Mail.WinUI.Dialogs.NewAccountDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:accounts="using:Wino.Core.Domain.Models.Accounts"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
|
xmlns:helpers="using:Wino.Helpers"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||||
|
Title="{x:Bind domain:Translator.NewAccountDialog_Title}"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
DefaultButton="Primary"
|
||||||
|
IsPrimaryButtonEnabled="False"
|
||||||
|
Opened="DialogOpened"
|
||||||
|
PrimaryButtonClick="CreateClicked"
|
||||||
|
PrimaryButtonText="{x:Bind domain:Translator.Buttons_CreateAccount}"
|
||||||
|
SecondaryButtonClick="CancelClicked"
|
||||||
|
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
|
||||||
|
Style="{StaticResource WinoDialogStyle}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<ContentDialog.Resources>
|
||||||
|
<DataTemplate x:Key="NewMailProviderTemplate" x:DataType="accounts:ProviderDetail">
|
||||||
|
<Grid Margin="0,8" Padding="6">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Image
|
||||||
|
Width="35"
|
||||||
|
Height="35"
|
||||||
|
Source="{x:Bind ProviderImage}" />
|
||||||
|
<StackPanel
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="12,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Spacing="2">
|
||||||
|
<TextBlock FontWeight="Bold" Text="{x:Bind Name}" />
|
||||||
|
<TextBlock Text="{x:Bind Description}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ContentDialog.Resources>
|
||||||
|
|
||||||
|
<Grid MinWidth="400" RowSpacing="12">
|
||||||
|
<Grid Visibility="{x:Bind IsProviderSelectionVisible, Mode=OneWay}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Account Name -->
|
||||||
|
|
||||||
|
<Grid ColumnSpacing="12">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
x:Name="AccountNameTextbox"
|
||||||
|
Header="{x:Bind domain:Translator.NewAccountDialog_AccountName}"
|
||||||
|
PlaceholderText="{x:Bind domain:Translator.NewAccountDialog_AccountNamePlaceholder}"
|
||||||
|
TextChanged="InputChanged" />
|
||||||
|
|
||||||
|
<Button Grid.Column="1" VerticalAlignment="Bottom">
|
||||||
|
<Grid>
|
||||||
|
<Ellipse
|
||||||
|
x:Name="SelectedColorEllipse"
|
||||||
|
Width="16"
|
||||||
|
Height="16" />
|
||||||
|
|
||||||
|
<TextBlock x:Name="PickColorTextblock" Text="{x:Bind domain:Translator.CalendarDisplayOptions_Color}" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Button.Flyout>
|
||||||
|
<Flyout Placement="TopEdgeAlignedLeft">
|
||||||
|
<GridView
|
||||||
|
Width="150"
|
||||||
|
ItemTemplate="{StaticResource AccountColorTemplate}"
|
||||||
|
ItemsSource="{x:Bind AvailableColors, Mode=OneWay}"
|
||||||
|
SelectedItem="{x:Bind SelectedColor, Mode=TwoWay}" />
|
||||||
|
</Flyout>
|
||||||
|
</Button.Flyout>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="0,12"
|
||||||
|
Padding="0"
|
||||||
|
ItemTemplate="{StaticResource NewMailProviderTemplate}"
|
||||||
|
ItemsSource="{x:Bind Providers}"
|
||||||
|
SelectedItem="{x:Bind SelectedMailProvider, Mode=TwoWay}"
|
||||||
|
SelectionMode="Single" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Known special IMAP login details. -->
|
||||||
|
<Grid RowSpacing="12" Visibility="{x:Bind IsSpecialImapServerPartVisible, Mode=OneWay}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Button Click="BackClicked">
|
||||||
|
<Button.Content>
|
||||||
|
<Viewbox Width="16">
|
||||||
|
<PathIcon Data="F1 M 20 9.375 C 20 9.544271 19.93815 9.690756 19.814453 9.814453 C 19.690754 9.938151 19.54427 10 19.375 10 L 2.138672 10 L 9.814453 17.685547 C 9.93815 17.809244 10 17.955729 10 18.125 C 10 18.294271 9.93815 18.440756 9.814453 18.564453 C 9.690755 18.68815 9.544271 18.75 9.375 18.75 C 9.205729 18.75 9.059244 18.68815 8.935547 18.564453 L 0.214844 9.84375 C 0.143229 9.772136 0.089518 9.700521 0.053711 9.628906 C 0.017904 9.557292 0 9.472656 0 9.375 C 0 9.277344 0.017904 9.192709 0.053711 9.121094 C 0.089518 9.049479 0.143229 8.977865 0.214844 8.90625 L 8.935547 0.185547 C 9.059244 0.06185 9.205729 0 9.375 0 C 9.544271 0 9.690755 0.06185 9.814453 0.185547 C 9.93815 0.309246 10 0.45573 10 0.625 C 10 0.794271 9.93815 0.940756 9.814453 1.064453 L 2.138672 8.75 L 19.375 8.75 C 19.54427 8.75 19.690754 8.81185 19.814453 8.935547 C 19.93815 9.059245 20 9.205729 20 9.375 Z " />
|
||||||
|
</Viewbox>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Image
|
||||||
|
Width="150"
|
||||||
|
Height="50"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Source="{x:Bind SelectedMailProvider.ProviderImage, Mode=OneWay}" />
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
x:Name="DisplayNameTextBox"
|
||||||
|
Grid.Row="1"
|
||||||
|
Header="Display Name"
|
||||||
|
PlaceholderText="eg. John Doe"
|
||||||
|
TextChanged="InputChanged" />
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
x:Name="SpecialImapAddress"
|
||||||
|
Grid.Row="2"
|
||||||
|
Header="E-mail Address"
|
||||||
|
PlaceholderText="eg. johndoe@testmail.com"
|
||||||
|
TextChanged="InputChanged" />
|
||||||
|
|
||||||
|
<PasswordBox
|
||||||
|
x:Name="AppSpecificPassword"
|
||||||
|
Grid.Row="3"
|
||||||
|
Header="App-Specific Password"
|
||||||
|
PasswordChanged="ImapPasswordChanged" />
|
||||||
|
|
||||||
|
<HyperlinkButton
|
||||||
|
Grid.Row="4"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Click="AppSpecificHelpButtonClicked"
|
||||||
|
Content="How do I get app-specific password?" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</ContentDialog>
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
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.Mail.WinUI.Dialogs;
|
||||||
|
|
||||||
|
public sealed partial class NewAccountDialog : ContentDialog
|
||||||
|
{
|
||||||
|
private Dictionary<SpecialImapProvider, string> helpingLinks = new Dictionary<SpecialImapProvider, string>()
|
||||||
|
{
|
||||||
|
{ 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); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets current selected mail provider in the dialog.
|
||||||
|
/// </summary>
|
||||||
|
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<IProviderDetail> Providers { get; set; }
|
||||||
|
|
||||||
|
public List<AppColorViewModel> 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Wino.Dialogs.NewImapSetupDialog"
|
x:Class="Wino.Dialogs.NewImapSetupDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
<ContentDialog
|
||||||
|
x:Class="Wino.Mail.WinUI.Dialogs.PrintDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:printing="using:Wino.Core.Domain.Models.Printing"
|
||||||
|
Title="Print Settings"
|
||||||
|
MinWidth="400"
|
||||||
|
MinHeight="300"
|
||||||
|
DefaultButton="Primary"
|
||||||
|
Loaded="PrintDialog_Loaded"
|
||||||
|
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
|
||||||
|
PrimaryButtonText="Print"
|
||||||
|
SecondaryButtonClick="ContentDialog_SecondaryButtonClick"
|
||||||
|
SecondaryButtonText="Cancel"
|
||||||
|
Style="{StaticResource WinoDialogStyle}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<StackPanel Margin="20" Spacing="16">
|
||||||
|
|
||||||
|
<!-- Printer Selection -->
|
||||||
|
<ComboBox
|
||||||
|
x:Name="PrinterComboBox"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
Header="Printer"
|
||||||
|
SelectedItem="{x:Bind PrintSettings.PrinterName, Mode=TwoWay}"
|
||||||
|
SelectionChanged="PrinterComboBox_SelectionChanged" />
|
||||||
|
|
||||||
|
<!-- Copies -->
|
||||||
|
<NumberBox
|
||||||
|
Header="Copies"
|
||||||
|
Maximum="999"
|
||||||
|
Minimum="1"
|
||||||
|
SpinButtonPlacementMode="Inline"
|
||||||
|
Value="{x:Bind PrintSettings.Copies, Mode=TwoWay}" />
|
||||||
|
|
||||||
|
<!-- Orientation -->
|
||||||
|
<RadioButtons
|
||||||
|
x:Name="OrientationRadioButtons"
|
||||||
|
Header="Orientation"
|
||||||
|
SelectionChanged="OrientationRadio_SelectionChanged">
|
||||||
|
<RadioButton Content="Portrait" />
|
||||||
|
<RadioButton Content="Landscape" />
|
||||||
|
</RadioButtons>
|
||||||
|
|
||||||
|
<!-- Print Options -->
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<TextBlock Text="Options" />
|
||||||
|
<CheckBox Content="Print backgrounds" IsChecked="{x:Bind PrintSettings.ShouldPrintBackgrounds, Mode=TwoWay}" />
|
||||||
|
<CheckBox Content="Print headers and footers" IsChecked="{x:Bind PrintSettings.ShouldPrintHeaderAndFooter, Mode=TwoWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</ContentDialog>
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
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.Mail.WinUI.Dialogs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Custom print dialog for configuring WebView2 print settings.
|
||||||
|
/// </summary>
|
||||||
|
public sealed partial class PrintDialog : ContentDialog
|
||||||
|
{
|
||||||
|
public WebView2PrintSettingsModel PrintSettings { get; set; } = new WebView2PrintSettingsModel();
|
||||||
|
|
||||||
|
public PrintDialog()
|
||||||
|
{
|
||||||
|
this.InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes the dialog with existing print settings.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="printSettings">The initial print settings to load.</param>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the list of available printers for the dialog.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="printers">List of available printer names.</param>
|
||||||
|
public void SetAvailablePrinters(IEnumerable<string> printers)
|
||||||
|
{
|
||||||
|
var printerList = printers?.ToList() ?? new List<string>();
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads available printers asynchronously and sets them in the dialog.
|
||||||
|
/// </summary>
|
||||||
|
public async Task LoadAvailablePrintersAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var printers = await Task.Run(() =>
|
||||||
|
{
|
||||||
|
var printerList = new List<string>();
|
||||||
|
|
||||||
|
// 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<string>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validates the current print settings before closing the dialog.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if settings are valid, false otherwise.</returns>
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Wino.Dialogs.SignatureEditorDialog"
|
x:Class="Wino.Dialogs.SignatureEditorDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
xmlns:controls="using:Wino.Controls"
|
xmlns:controls="using:Wino.Controls"
|
||||||
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
||||||
xmlns:controls2="using:Wino.Mail.Controls"
|
xmlns:controls2="using:Wino.Mail.Controls"
|
||||||
xmlns:coreControls="using:Wino.Core.WinUI.Controls"
|
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
using Wino.Core.Domain;
|
using Wino.Core.Domain;
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Wino.Dialogs.SystemFolderConfigurationDialog"
|
x:Class="Wino.Dialogs.SystemFolderConfigurationDialog"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="using:Wino.Controls"
|
xmlns:controls="using:Wino.Controls"
|
||||||
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
||||||
xmlns:coreControls="using:Wino.Core.WinUI.Controls"
|
xmlns:coreControls="using:Wino.Mail.WinUI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.UI.Xaml.Controls;
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<ContentDialog
|
||||||
|
x:Class="Wino.Dialogs.TextInputDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
VerticalContentAlignment="Stretch"
|
||||||
|
DefaultButton="Primary"
|
||||||
|
PrimaryButtonClick="UpdateOrCreateClicked"
|
||||||
|
SecondaryButtonClick="CancelClicked"
|
||||||
|
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Cancel}"
|
||||||
|
Style="{StaticResource WinoDialogStyle}"
|
||||||
|
mc:Ignorable="d">
|
||||||
|
|
||||||
|
<ContentDialog.Resources>
|
||||||
|
<x:Double x:Key="ContentDialogMinWidth">400</x:Double>
|
||||||
|
<x:Double x:Key="ContentDialogMaxWidth">400</x:Double>
|
||||||
|
<x:Double x:Key="ContentDialogMinHeight">200</x:Double>
|
||||||
|
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>
|
||||||
|
</ContentDialog.Resources>
|
||||||
|
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<TextBlock x:Name="DialogDescription" TextWrapping="Wrap" />
|
||||||
|
<TextBox x:Name="FolderTextBox" Text="{x:Bind CurrentInput, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
</ContentDialog>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||