Files
Wino-Mail/Wino.Mail/MenuFlyouts/WinoOperationFlyoutItem.cs
Aleh Khantsevich 2ec05ea7cc UWP .NET9 (#555)
* Ground work for NET9 UWP switch.

* Add launch settings for Wino.Mail

* Added new test WAP project

* fix platforms in slnx solution

* ManagePackageVersionsCentrally set default

* Fixing assets and couple issues with the new packaging project.

* Add back markdown

* Fix nuget warnings

* FIx error in WAP about build tools

* Add build.props with default language preview

* Some AOT compilation progress.

* More AOT stuff.

* Remove deprecated protocol auth activation handler.

* Fix remaining protocol handler for google auth.

* Even more AOT

* More more AOT fixes

* Fix a few more AOT warnings

* Fix signature editor AOT

* Fix composer and renderer AOT JSON

* Outlook Sync AOT

* Fixing bundle generation and package signing.

---------

Co-authored-by: Burak Kaan Köse <bkaankose@outlook.com>
2025-02-14 01:43:52 +01:00

59 lines
1.9 KiB
C#

using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Wino.Core.Domain.Interfaces;
using Wino.Core.Domain.Models.Folders;
using Wino.Core.Domain.Models.Menus;
using Wino.Core.UWP.Controls;
using Wino.Helpers;
namespace Wino.MenuFlyouts
{
public partial class WinoOperationFlyoutItem<TOperationMenuItem> : MenuFlyoutItem, IDisposable where TOperationMenuItem : IMenuOperation
{
private const double CustomHeight = 35;
public TOperationMenuItem Operation { get; set; }
Action<TOperationMenuItem> Clicked { get; set; }
public WinoOperationFlyoutItem(TOperationMenuItem operationMenuItem, Action<TOperationMenuItem> clicked)
{
Margin = new Thickness(4, 2, 4, 2);
CornerRadius = new CornerRadius(6, 6, 6, 6);
MinHeight = CustomHeight;
Operation = operationMenuItem;
IsEnabled = operationMenuItem.IsEnabled;
if (Operation is FolderOperationMenuItem folderOperationMenuItem)
{
var internalOperation = folderOperationMenuItem.Operation;
Icon = new WinoFontIcon() { Icon = XamlHelpers.GetPathGeometry(internalOperation) };
Text = XamlHelpers.GetOperationString(internalOperation);
}
else if (Operation is MailOperationMenuItem mailOperationMenuItem)
{
var internalOperation = mailOperationMenuItem.Operation;
Icon = new WinoFontIcon() { Icon = XamlHelpers.GetWinoIconGlyph(internalOperation) };
Text = XamlHelpers.GetOperationString(internalOperation);
}
Clicked = clicked;
Click += MenuClicked;
}
private void MenuClicked(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
Clicked(Operation);
}
public void Dispose()
{
Click -= MenuClicked;
}
}
}