You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.6 KiB
C#

using Khd.Core.Domain.Models;
using System.Collections.Generic;
using System.Windows.Media;
namespace Khd.Core.Wpf
{
public static class SystemData
{
public static IEnumerable<Visual> 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<BasePlcpoint> BasePlcpoints { get; set; }
public static List<BaseEquip> BaseEquip { get; internal set; }
public static List<WmsBaseWarehouse> BaseWareHouse { get; internal set; }
public static List<MesBaseMaterialInfo> MesBaseMaterialInfo { get; set; }
public static List<BaseDictionary> BaseDictionary = new List<BaseDictionary>();
public static List<PlcConfig> PlcConfigs = new List<PlcConfig>();
public static Dictionary<int, Plc.S7.Plc> PlcDic = new Dictionary<int, Plc.S7.Plc>();
}
}