@@ -2,6 +2,7 @@
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.UWP.Controls;
|
||||
|
||||
namespace Wino.Controls
|
||||
{
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,206 +0,0 @@
|
||||
using System.Windows.Input;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Controls.Advanced
|
||||
{
|
||||
public sealed partial class WinoAppTitleBar : UserControl
|
||||
{
|
||||
public event TypedEventHandler<WinoAppTitleBar, RoutedEventArgs> BackButtonClicked;
|
||||
|
||||
public static readonly DependencyProperty IsRenderingPaneVisibleProperty = DependencyProperty.Register(nameof(IsRenderingPaneVisible), typeof(bool), typeof(WinoAppTitleBar), new PropertyMetadata(false, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty IsReaderNarrowedProperty = DependencyProperty.Register(nameof(IsReaderNarrowed), typeof(bool), typeof(WinoAppTitleBar), new PropertyMetadata(false, OnIsReaderNarrowedChanged));
|
||||
public static readonly DependencyProperty IsBackButtonVisibleProperty = DependencyProperty.Register(nameof(IsBackButtonVisible), typeof(bool), typeof(WinoAppTitleBar), new PropertyMetadata(false, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty OpenPaneLengthProperty = DependencyProperty.Register(nameof(OpenPaneLength), typeof(double), typeof(WinoAppTitleBar), new PropertyMetadata(0d, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty IsNavigationPaneOpenProperty = DependencyProperty.Register(nameof(IsNavigationPaneOpen), typeof(bool), typeof(WinoAppTitleBar), new PropertyMetadata(false, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty NavigationViewDisplayModeProperty = DependencyProperty.Register(nameof(NavigationViewDisplayMode), typeof(Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode), typeof(WinoAppTitleBar), new PropertyMetadata(Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Compact, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty ShellFrameContentProperty = DependencyProperty.Register(nameof(ShellFrameContent), typeof(UIElement), typeof(WinoAppTitleBar), new PropertyMetadata(null, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty SystemReservedProperty = DependencyProperty.Register(nameof(SystemReserved), typeof(double), typeof(WinoAppTitleBar), new PropertyMetadata(0, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty CoreWindowTextProperty = DependencyProperty.Register(nameof(CoreWindowText), typeof(string), typeof(WinoAppTitleBar), new PropertyMetadata(string.Empty, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty ReadingPaneLengthProperty = DependencyProperty.Register(nameof(ReadingPaneLength), typeof(double), typeof(WinoAppTitleBar), new PropertyMetadata(420d, OnDrawingPropertyChanged));
|
||||
public static readonly DependencyProperty ConnectionStatusProperty = DependencyProperty.Register(nameof(ConnectionStatus), typeof(WinoServerConnectionStatus), typeof(WinoAppTitleBar), new PropertyMetadata(WinoServerConnectionStatus.None, new PropertyChangedCallback(OnConnectionStatusChanged)));
|
||||
public static readonly DependencyProperty ReconnectCommandProperty = DependencyProperty.Register(nameof(ReconnectCommand), typeof(ICommand), typeof(WinoAppTitleBar), new PropertyMetadata(null));
|
||||
|
||||
public ICommand ReconnectCommand
|
||||
{
|
||||
get { return (ICommand)GetValue(ReconnectCommandProperty); }
|
||||
set { SetValue(ReconnectCommandProperty, value); }
|
||||
}
|
||||
|
||||
public WinoServerConnectionStatus ConnectionStatus
|
||||
{
|
||||
get { return (WinoServerConnectionStatus)GetValue(ConnectionStatusProperty); }
|
||||
set { SetValue(ConnectionStatusProperty, value); }
|
||||
}
|
||||
|
||||
public string CoreWindowText
|
||||
{
|
||||
get { return (string)GetValue(CoreWindowTextProperty); }
|
||||
set { SetValue(CoreWindowTextProperty, value); }
|
||||
}
|
||||
|
||||
public double SystemReserved
|
||||
{
|
||||
get { return (double)GetValue(SystemReservedProperty); }
|
||||
set { SetValue(SystemReservedProperty, value); }
|
||||
}
|
||||
|
||||
public UIElement ShellFrameContent
|
||||
{
|
||||
get { return (UIElement)GetValue(ShellFrameContentProperty); }
|
||||
set { SetValue(ShellFrameContentProperty, value); }
|
||||
}
|
||||
|
||||
public Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode NavigationViewDisplayMode
|
||||
{
|
||||
get { return (Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode)GetValue(NavigationViewDisplayModeProperty); }
|
||||
set { SetValue(NavigationViewDisplayModeProperty, value); }
|
||||
}
|
||||
|
||||
public bool IsNavigationPaneOpen
|
||||
{
|
||||
get { return (bool)GetValue(IsNavigationPaneOpenProperty); }
|
||||
set { SetValue(IsNavigationPaneOpenProperty, value); }
|
||||
}
|
||||
|
||||
public double OpenPaneLength
|
||||
{
|
||||
get { return (double)GetValue(OpenPaneLengthProperty); }
|
||||
set { SetValue(OpenPaneLengthProperty, value); }
|
||||
}
|
||||
|
||||
public bool IsBackButtonVisible
|
||||
{
|
||||
get { return (bool)GetValue(IsBackButtonVisibleProperty); }
|
||||
set { SetValue(IsBackButtonVisibleProperty, value); }
|
||||
}
|
||||
|
||||
public bool IsReaderNarrowed
|
||||
{
|
||||
get { return (bool)GetValue(IsReaderNarrowedProperty); }
|
||||
set { SetValue(IsReaderNarrowedProperty, value); }
|
||||
}
|
||||
|
||||
public bool IsRenderingPaneVisible
|
||||
{
|
||||
get { return (bool)GetValue(IsRenderingPaneVisibleProperty); }
|
||||
set { SetValue(IsRenderingPaneVisibleProperty, value); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public double ReadingPaneLength
|
||||
{
|
||||
get { return (double)GetValue(ReadingPaneLengthProperty); }
|
||||
set { SetValue(ReadingPaneLengthProperty, value); }
|
||||
}
|
||||
|
||||
private static void OnIsReaderNarrowedChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
if (obj is WinoAppTitleBar bar)
|
||||
{
|
||||
bar.DrawTitleBar();
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnDrawingPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
if (obj is WinoAppTitleBar bar)
|
||||
{
|
||||
bar.DrawTitleBar();
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnConnectionStatusChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
if (obj is WinoAppTitleBar bar)
|
||||
{
|
||||
bar.UpdateConnectionStatus();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateConnectionStatus()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void DrawTitleBar()
|
||||
{
|
||||
UpdateLayout();
|
||||
|
||||
CoreWindowTitleTextBlock.Visibility = Visibility.Collapsed;
|
||||
ShellContentContainer.Width = double.NaN;
|
||||
ShellContentContainer.Margin = new Thickness(0, 0, 0, 0);
|
||||
ShellContentContainer.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||
|
||||
EmptySpaceWidth.Width = new GridLength(1, GridUnitType.Star);
|
||||
|
||||
// Menu is not visible.
|
||||
if (NavigationViewDisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Minimal)
|
||||
{
|
||||
|
||||
}
|
||||
else if (NavigationViewDisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Compact)
|
||||
{
|
||||
// Icons are visible.
|
||||
|
||||
if (!IsReaderNarrowed)
|
||||
{
|
||||
ShellContentContainer.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
ShellContentContainer.Width = ReadingPaneLength;
|
||||
}
|
||||
}
|
||||
else if (NavigationViewDisplayMode == Microsoft.UI.Xaml.Controls.NavigationViewDisplayMode.Expanded)
|
||||
{
|
||||
if (IsNavigationPaneOpen)
|
||||
{
|
||||
CoreWindowTitleTextBlock.Visibility = Visibility.Visible;
|
||||
|
||||
// LMargin = OpenPaneLength - LeftMenuStackPanel
|
||||
ShellContentContainer.Margin = new Thickness(OpenPaneLength - LeftMenuStackPanel.ActualSize.X, 0, 0, 0);
|
||||
|
||||
if (!IsReaderNarrowed)
|
||||
{
|
||||
ShellContentContainer.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
ShellContentContainer.Width = ReadingPaneLength;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EmptySpaceWidth.Width = new GridLength(ReadingPaneLength, GridUnitType.Pixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public WinoAppTitleBar()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
Window.Current.SetTitleBar(dragbar);
|
||||
}
|
||||
|
||||
private void BackClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BackButtonClicked?.Invoke(this, e);
|
||||
}
|
||||
|
||||
private void PaneClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
IsNavigationPaneOpen = !IsNavigationPaneOpen;
|
||||
}
|
||||
|
||||
private void TitlebarSizeChanged(object sender, SizeChangedEventArgs e) => DrawTitleBar();
|
||||
|
||||
private void ReconnectClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Close the popup for reconnect button.
|
||||
ReconnectFlyout.Hide();
|
||||
|
||||
// Execute the reconnect command.
|
||||
ReconnectCommand?.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Wino.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, "\uE954" },
|
||||
{ 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" }
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
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.UWP.Controls"
|
||||
xmlns:domain="using:Wino.Core.Domain"
|
||||
xmlns:enums="using:Wino.Core.Domain.Enums"
|
||||
xmlns:helpers="using:Wino.Helpers"
|
||||
@@ -139,19 +140,19 @@
|
||||
</StackPanel.ChildrenTransitions>
|
||||
<Button Click="FirstActionClicked" Style="{StaticResource HoverActionButtonStyle}">
|
||||
<Button.Content>
|
||||
<controls:WinoFontIcon FontSize="16" Icon="{x:Bind helpers:XamlHelpers.GetWinoIconGlyph(LeftHoverAction), Mode=OneWay}" />
|
||||
<coreControls:WinoFontIcon FontSize="16" Icon="{x:Bind helpers:XamlHelpers.GetWinoIconGlyph(LeftHoverAction), Mode=OneWay}" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<Button Click="SecondActionClicked" Style="{StaticResource HoverActionButtonStyle}">
|
||||
<Button.Content>
|
||||
<controls:WinoFontIcon FontSize="16" Icon="{x:Bind helpers:XamlHelpers.GetWinoIconGlyph(CenterHoverAction), Mode=OneWay}" />
|
||||
<coreControls:WinoFontIcon FontSize="16" Icon="{x:Bind helpers:XamlHelpers.GetWinoIconGlyph(CenterHoverAction), Mode=OneWay}" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<Button Click="ThirdActionClicked" Style="{StaticResource HoverActionButtonStyle}">
|
||||
<Button.Content>
|
||||
<controls:WinoFontIcon FontSize="16" Icon="{x:Bind helpers:XamlHelpers.GetWinoIconGlyph(RightHoverAction), Mode=OneWay}" />
|
||||
<coreControls:WinoFontIcon FontSize="16" Icon="{x:Bind helpers:XamlHelpers.GetWinoIconGlyph(RightHoverAction), Mode=OneWay}" />
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Numerics;
|
||||
using System.Windows.Input;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Entities;
|
||||
using Wino.Core.Domain.Entities.Mail;
|
||||
using Wino.Core.Domain.Enums;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
using Wino.Extensions;
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
||||
namespace Wino.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
|
||||
}
|
||||
|
||||
public 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 Windows.UI.Xaml.Media.FontFamily("ms-appx:///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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using Windows.UI.Xaml;
|
||||
|
||||
namespace Wino.Controls
|
||||
{
|
||||
public 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 Windows.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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using CommunityToolkit.WinUI.Animations;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml;
|
||||
using Wino.Core.Domain.Enums;
|
||||
|
||||
namespace Wino.Controls
|
||||
{
|
||||
public 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System.Numerics;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Hosting;
|
||||
|
||||
namespace Wino.Controls
|
||||
{
|
||||
public 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 (this.Content is UIElement content)
|
||||
{
|
||||
var visual = ElementCompositionPreview.GetElementVisual(content);
|
||||
visual.Scale = vector;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user