| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- 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;
- }
- /// <summary>
- /// 统一的数据变更通知入口,供各业务写库后广播,界面按需订阅刷新。
- /// </summary>
- public static class MesDataChangedNotifier
- {
- public static event EventHandler<MesDataChangedEventArgs> Changed;
- public static void Raise(MesDataScope scope)
- {
- if (scope == MesDataScope.None)
- {
- return;
- }
- Changed?.Invoke(null, new MesDataChangedEventArgs(scope));
- }
- }
- }
|