Merge core project into winui project.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.WinUI.Controls;
|
||||
using Wino.Mail.WinUI.Controls;
|
||||
|
||||
namespace Wino.Controls;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Input;
|
||||
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.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CommunityToolkit.WinUI;
|
||||
using CommunityToolkit.WinUI;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using CommunityToolkit.WinUI;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Controls;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<UserControl
|
||||
<UserControl
|
||||
x:Class="Wino.Controls.MailItemDisplayInformationControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
|
||||
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:enums="using:Wino.Core.Domain.Enums"
|
||||
xmlns:helpers="using:Wino.Helpers"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Windows.Input;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,7 +12,7 @@ using Wino.Core.Domain;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models;
|
||||
using Wino.Core.Domain.Models.Reader;
|
||||
using Wino.Core.WinUI.Extensions;
|
||||
using Wino.Mail.WinUI.Extensions;
|
||||
using Wino.Mail.WinUI;
|
||||
|
||||
namespace Wino.Mail.Controls;
|
||||
@@ -139,7 +139,7 @@ public sealed partial class WebViewEditorControl : Control, IDisposable
|
||||
{
|
||||
this.DefaultStyleKey = typeof(WebViewEditorControl);
|
||||
|
||||
IsEditorDarkMode = Core.WinUI.WinoApplication.Current.UnderlyingThemeService.IsUnderlyingThemeDark();
|
||||
IsEditorDarkMode = WinoApplication.Current.UnderlyingThemeService.IsUnderlyingThemeDark();
|
||||
}
|
||||
|
||||
protected override async void OnApplyTemplate()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
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 Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.WinUI;
|
||||
using Wino.Mail.WinUI;
|
||||
using Wino.Helpers;
|
||||
using Wino.Mail.ViewModels.Data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user