更新项目配置,新增设备同步模块,优化WebSocket和Swagger配置,增强SCADA系统的免登录接口,支持数据字典项和登录日志的免登录查询与记录。调整Java编译设置,确保更好的开发体验。
This commit is contained in:
46
yy-admin-master/YY.Admin.Core/Extension/WindowExtensions.cs
Normal file
46
yy-admin-master/YY.Admin.Core/Extension/WindowExtensions.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
|
||||
namespace YY.Admin.Core.Extension
|
||||
{
|
||||
/// <summary>
|
||||
/// 窗体的扩展类
|
||||
/// </summary>
|
||||
public static class WindowExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 查找子控件
|
||||
/// </summary>
|
||||
/// <typeparam name="T">子控件的类型</typeparam>
|
||||
/// <param name="obj">要找的是obj的子控件</param>
|
||||
/// <param name="name">想找的子控件的Name属性</param>
|
||||
/// <returns>目标子控件</returns>
|
||||
public static T GetChildObject<T>(this DependencyObject obj, string name) where T : FrameworkElement
|
||||
{
|
||||
DependencyObject child = null;
|
||||
T grandChild = null;
|
||||
|
||||
for (int i = 0; i <= VisualTreeHelper.GetChildrenCount(obj) - 1; i++)
|
||||
{
|
||||
child = VisualTreeHelper.GetChild(obj, i);
|
||||
|
||||
if (child is T && (((T)child).Name == name | string.IsNullOrEmpty(name)))
|
||||
{
|
||||
return (T)child;
|
||||
}
|
||||
else
|
||||
{
|
||||
grandChild = GetChildObject<T>(child, name);
|
||||
if (grandChild != null)
|
||||
return grandChild;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user