分离玩家信息插件,以及更新检测
This commit is contained in:
29
Utils/WpfExtensions.cs
Normal file
29
Utils/WpfExtensions.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
|
||||
namespace AnotherReplayReader.Utils
|
||||
{
|
||||
internal static class WpfExtensions
|
||||
{
|
||||
public static IEnumerable<T> FindVisualChildren<T>(this DependencyObject depObj) where T : DependencyObject
|
||||
{
|
||||
foreach (var x in LogicalTreeHelper.GetChildren(depObj))
|
||||
{
|
||||
if (x is not DependencyObject child)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child is T tchild)
|
||||
{
|
||||
yield return tchild;
|
||||
}
|
||||
|
||||
foreach (var childOfChild in FindVisualChildren<T>(child))
|
||||
{
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user