using Khd.Core.Domain.Models; using System.Collections.Generic; using System.Windows.Media; namespace Khd.Core.Wpf { public static class SystemData { public static IEnumerable GetChildren(this Visual parent, bool recurse = true) { if (parent != null) { int count = VisualTreeHelper.GetChildrenCount(parent); for (int i = 0; i < count; i++) { // Retrieve child visual at specified index value. var child = VisualTreeHelper.GetChild(parent, i) as Visual; if (child != null) { yield return child;// 聚集函数,调用到这不会立刻结束方法,而是在集合中添加元素,直到方法结束,将集合返回 if (recurse) { foreach (var grandChild in child.GetChildren(true)) { yield return grandChild; } } } } } } public static string _message { get; set; } public static object _lock = new object(); public static string message { get { lock (_lock) { return _message; } } set { lock (_lock) { _message = value; } } } public static bool _isUpdate { get; set; } public static object _updateLock = new object(); public static bool isUpdate { get { lock (_updateLock) { return _isUpdate; } } set { lock (_updateLock) { _isUpdate = value; } } } public static List BasePlcpoints { get; set; } public static List BaseEquip { get; internal set; } public static List BaseWareHouse { get; internal set; } public static List MesBaseMaterialInfo { get; set; } public static List BaseDictionary = new List(); public static List PlcConfigs = new List(); public static Dictionary PlcDic = new Dictionary(); } }