using System; namespace LocalhostMES.Core { [Flags] public enum MesDataScope { None = 0, WorkOrder = 1 << 0, Sn = 1 << 1, KeyPart = 1 << 2, ParkingLot = 1 << 3, BindRecord = 1 << 4, ProcessRecord = 1 << 5 } public sealed class MesDataChangedEventArgs : EventArgs { public MesDataChangedEventArgs(MesDataScope scope) { Scope = scope; } public MesDataScope Scope { get; } public bool Has(MesDataScope target) => (Scope & target) == target; } /// /// 统一的数据变更通知入口,供各业务写库后广播,界面按需订阅刷新。 /// public static class MesDataChangedNotifier { public static event EventHandler Changed; public static void Raise(MesDataScope scope) { if (scope == MesDataScope.None) { return; } Changed?.Invoke(null, new MesDataChangedEventArgs(scope)); } } }