Browse Source
Merge pull request #3493 from MarchingCube/refactor-type-info-bulk
Remove TypeInfo usage from multiple projects.
pull/3507/head
Jumar Macato
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
5 additions and
14 deletions
-
src/Avalonia.Interactivity/RoutedEvent.cs
-
src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs
-
src/Avalonia.Visuals/VisualTree/VisualLocator.cs
-
src/Markup/Avalonia.Markup.Xaml/Templates/DataTemplate.cs
-
src/Markup/Avalonia.Markup.Xaml/Templates/TreeDataTemplate.cs
|
|
|
@ -3,7 +3,6 @@ |
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Reactive.Subjects; |
|
|
|
using System.Reflection; |
|
|
|
|
|
|
|
namespace Avalonia.Interactivity |
|
|
|
{ |
|
|
|
@ -29,7 +28,7 @@ namespace Avalonia.Interactivity |
|
|
|
Contract.Requires<ArgumentNullException>(name != null); |
|
|
|
Contract.Requires<ArgumentNullException>(eventArgsType != null); |
|
|
|
Contract.Requires<ArgumentNullException>(ownerType != null); |
|
|
|
Contract.Requires<InvalidCastException>(typeof(RoutedEventArgs).GetTypeInfo().IsAssignableFrom(eventArgsType.GetTypeInfo())); |
|
|
|
Contract.Requires<InvalidCastException>(typeof(RoutedEventArgs).IsAssignableFrom(eventArgsType)); |
|
|
|
|
|
|
|
EventArgsType = eventArgsType; |
|
|
|
Name = name; |
|
|
|
|
|
|
|
@ -2,9 +2,7 @@ |
|
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Reflection; |
|
|
|
using System.Reactive.Linq; |
|
|
|
using Avalonia; |
|
|
|
using Avalonia.VisualTree; |
|
|
|
using Avalonia.Controls; |
|
|
|
using ReactiveUI; |
|
|
|
@ -21,7 +19,7 @@ namespace Avalonia.ReactiveUI |
|
|
|
/// </summary>
|
|
|
|
public int GetAffinityForView(Type view) |
|
|
|
{ |
|
|
|
return typeof(IVisual).GetTypeInfo().IsAssignableFrom(view.GetTypeInfo()) ? 10 : 0; |
|
|
|
return typeof(IVisual).IsAssignableFrom(view) ? 10 : 0; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
@ -1,7 +1,5 @@ |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using System.Reactive.Linq; |
|
|
|
using System.Reflection; |
|
|
|
using Avalonia.Reactive; |
|
|
|
|
|
|
|
namespace Avalonia.VisualTree |
|
|
|
@ -50,7 +48,7 @@ namespace Avalonia.VisualTree |
|
|
|
if (_relativeTo.IsAttachedToVisualTree) |
|
|
|
{ |
|
|
|
return _relativeTo.GetVisualAncestors() |
|
|
|
.Where(x => _ancestorType?.GetTypeInfo().IsAssignableFrom(x.GetType().GetTypeInfo()) ?? true) |
|
|
|
.Where(x => _ancestorType?.IsAssignableFrom(x.GetType()) ?? true) |
|
|
|
.ElementAtOrDefault(_ancestorLevel); |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
@ -2,7 +2,6 @@ |
|
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Reflection; |
|
|
|
using Avalonia.Controls; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Metadata; |
|
|
|
@ -28,7 +27,7 @@ namespace Avalonia.Markup.Xaml.Templates |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return DataType.GetTypeInfo().IsAssignableFrom(data.GetType().GetTypeInfo()); |
|
|
|
return DataType.IsInstanceOfType(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -2,12 +2,9 @@ |
|
|
|
// Licensed under the MIT license. See licence.md file in the project root for full license information.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Reflection; |
|
|
|
using Avalonia.Controls; |
|
|
|
using Avalonia.Controls.Templates; |
|
|
|
using Avalonia.Data; |
|
|
|
using Avalonia.Data.Core; |
|
|
|
using Avalonia.Markup.Data; |
|
|
|
using Avalonia.Markup.Parsers; |
|
|
|
using Avalonia.Metadata; |
|
|
|
|
|
|
|
@ -34,7 +31,7 @@ namespace Avalonia.Markup.Xaml.Templates |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return DataType.GetTypeInfo().IsAssignableFrom(data.GetType().GetTypeInfo()); |
|
|
|
return DataType.IsInstanceOfType(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|