Tidy up namespaces
This commit is contained in:
@@ -1,24 +1,23 @@
|
||||
using Avalonia.Data.Converters;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Toolkit.Foundation.Avalonia
|
||||
namespace Toolkit.Foundation.Avalonia;
|
||||
|
||||
public static class EventArgsExtensions
|
||||
{
|
||||
public static class EventArgsExtensions
|
||||
public static dynamic? GetEventArguments(this EventArgs args, string? path, IValueConverter? converter, object? converterParameter)
|
||||
{
|
||||
public static dynamic? GetEventArguments(this EventArgs args, string? path, IValueConverter? converter, object? converterParameter)
|
||||
return !string.IsNullOrWhiteSpace(path) ? GetEventArgsPropertyPathValue(args, path) : converter is not null ? converter.Convert(args, typeof(object), converterParameter, CultureInfo.CurrentCulture) : (dynamic)args;
|
||||
}
|
||||
|
||||
private static object GetEventArgsPropertyPathValue(object args, string path)
|
||||
{
|
||||
object? value = args;
|
||||
if (path is { })
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(path) ? GetEventArgsPropertyPathValue(args, path) : converter is not null ? converter.Convert(args, typeof(object), converterParameter, CultureInfo.CurrentCulture) : (dynamic)args;
|
||||
value = PropertyPathHelper.GetValue(args, path);
|
||||
}
|
||||
|
||||
private static object GetEventArgsPropertyPathValue(object args, string path)
|
||||
{
|
||||
object? value = args;
|
||||
if (path is { })
|
||||
{
|
||||
value = PropertyPathHelper.GetValue(args, path);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user