mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Remove useless class
This commit is contained in:
parent
68fc103d7f
commit
6143c99454
1 changed files with 0 additions and 58 deletions
|
|
@ -1,58 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
|
|
||||||
namespace Flow.Launcher.Infrastructure.UI
|
|
||||||
{
|
|
||||||
[Obsolete("EnumBindingSourceExtension is obsolete. Use with Flow.Launcher.Localization NuGet package instead.")]
|
|
||||||
public class EnumBindingSourceExtension : MarkupExtension
|
|
||||||
{
|
|
||||||
private Type _enumType;
|
|
||||||
public Type EnumType
|
|
||||||
{
|
|
||||||
get { return _enumType; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value != _enumType)
|
|
||||||
{
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
Type enumType = Nullable.GetUnderlyingType(value) ?? value;
|
|
||||||
if (!enumType.IsEnum)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Type must represent an enum.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_enumType = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumBindingSourceExtension() { }
|
|
||||||
|
|
||||||
public EnumBindingSourceExtension(Type enumType)
|
|
||||||
{
|
|
||||||
EnumType = enumType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
|
||||||
{
|
|
||||||
if (_enumType == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException("The EnumType must be specified.");
|
|
||||||
}
|
|
||||||
|
|
||||||
Type actualEnumType = Nullable.GetUnderlyingType(_enumType) ?? _enumType;
|
|
||||||
Array enumValues = Enum.GetValues(actualEnumType);
|
|
||||||
|
|
||||||
if (actualEnumType == _enumType)
|
|
||||||
{
|
|
||||||
return enumValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
Array tempArray = Array.CreateInstance(actualEnumType, enumValues.Length + 1);
|
|
||||||
enumValues.CopyTo(tempArray, 1);
|
|
||||||
return tempArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in a new issue