Sic.Framework/MECF.Framework.UI.Core/Converters/IntPermissionToIsEnabledCon...

27 lines
847 B
C#
Raw Permalink Normal View History

using System;
using System.Globalization;
using System.Windows.Data;
using MECF.Framework.Common.Account;
using MECF.Framework.Common.Account.Permissions;
namespace MECF.Framework.UI.Core.Converters
{
public class IntPermissionToIsEnabledConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int intPerm && Enum.IsDefined(typeof(MenuPermissionEnum), intPerm))
{
var perm = (MenuPermissionEnum)intPerm;
return perm == MenuPermissionEnum.MP_READ_WRITE;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}