Files
Wino-Mail/Wino.Core.Domain/Models/Menus/MenuOperationItemBase.cs
T

51 lines
1.2 KiB
C#
Raw Normal View History

using System;
using CommunityToolkit.Mvvm.ComponentModel;
using Wino.Core.Domain.Interfaces;
2024-04-18 01:44:37 +02:00
2025-02-16 11:54:23 +01:00
namespace Wino.Core.Domain.Models.Menus;
public class MenuOperationItemBase<TOperation> : ObservableObject, IMenuOperation where TOperation : Enum
2024-04-18 01:44:37 +02:00
{
private TOperation _operation;
private string _identifier = string.Empty;
private bool _isEnabled;
private bool _isSecondaryMenuPreferred;
2025-02-16 11:54:23 +01:00
public MenuOperationItemBase(TOperation operation, bool isEnabled)
2024-04-18 01:44:37 +02:00
{
2025-02-16 11:54:23 +01:00
Operation = operation;
IsEnabled = isEnabled;
Identifier = operation.ToString();
2025-02-16 11:43:30 +01:00
}
2025-02-16 11:54:23 +01:00
public TOperation Operation
{
get => _operation;
set
{
if (SetProperty(ref _operation, value))
{
Identifier = value.ToString();
}
}
}
public string Identifier
{
get => _identifier;
protected set => SetProperty(ref _identifier, value);
}
public bool IsEnabled
{
get => _isEnabled;
set => SetProperty(ref _isEnabled, value);
}
public bool IsSecondaryMenuPreferred
{
get => _isSecondaryMenuPreferred;
set => SetProperty(ref _isSecondaryMenuPreferred, value);
}
2024-04-18 01:44:37 +02:00
}