chore: use file-scoped namespace
This commit is contained in:
1 parent
99d2fafb72
commit
bbf1b7d4c6
748 files changed
+57929
-58678
No files matched your search
@@ -2,48 +2,47 @@
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
||||
namespace HandyControl.Interactivity
|
||||
namespace HandyControl.Interactivity;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = true)]
|
||||
public sealed class DefaultTriggerAttribute : Attribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = true)]
|
||||
public sealed class DefaultTriggerAttribute : Attribute
|
||||
private readonly object[] _parameters;
|
||||
|
||||
public DefaultTriggerAttribute(Type targetType, Type triggerType, object parameter) : this(targetType,
|
||||
triggerType, new[] { parameter })
|
||||
{
|
||||
private readonly object[] _parameters;
|
||||
|
||||
public DefaultTriggerAttribute(Type targetType, Type triggerType, object parameter) : this(targetType,
|
||||
triggerType, new[] { parameter })
|
||||
{
|
||||
}
|
||||
|
||||
public DefaultTriggerAttribute(Type targetType, Type triggerType, params object[] parameters)
|
||||
{
|
||||
if (!typeof(TriggerBase).IsAssignableFrom(triggerType))
|
||||
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
|
||||
ExceptionStringTable.DefaultTriggerAttributeInvalidTriggerTypeSpecifiedExceptionMessage,
|
||||
new object[] { triggerType.Name }));
|
||||
TargetType = targetType;
|
||||
TriggerType = triggerType;
|
||||
_parameters = parameters;
|
||||
}
|
||||
|
||||
public IEnumerable Parameters =>
|
||||
_parameters;
|
||||
|
||||
public Type TargetType { get; }
|
||||
|
||||
public Type TriggerType { get; }
|
||||
|
||||
public TriggerBase Instantiate()
|
||||
{
|
||||
object obj2 = null;
|
||||
try
|
||||
{
|
||||
obj2 = Activator.CreateInstance(TriggerType, _parameters);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
return (TriggerBase) obj2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DefaultTriggerAttribute(Type targetType, Type triggerType, params object[] parameters)
|
||||
{
|
||||
if (!typeof(TriggerBase).IsAssignableFrom(triggerType))
|
||||
throw new ArgumentException(string.Format(CultureInfo.CurrentCulture,
|
||||
ExceptionStringTable.DefaultTriggerAttributeInvalidTriggerTypeSpecifiedExceptionMessage,
|
||||
new object[] { triggerType.Name }));
|
||||
TargetType = targetType;
|
||||
TriggerType = triggerType;
|
||||
_parameters = parameters;
|
||||
}
|
||||
|
||||
public IEnumerable Parameters =>
|
||||
_parameters;
|
||||
|
||||
public Type TargetType { get; }
|
||||
|
||||
public Type TriggerType { get; }
|
||||
|
||||
public TriggerBase Instantiate()
|
||||
{
|
||||
object obj2 = null;
|
||||
try
|
||||
{
|
||||
obj2 = Activator.CreateInstance(TriggerType, _parameters);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
return (TriggerBase) obj2;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user