/// <summary> /// 事件所对应的方法 /// </summary> /// <param name="eb"></param> static void getSome(EventBase eb) { EventWithValue ev = eb as EventWithValue; int i = (int)ev.value1; Console.WriteLine(ev.eventName + " " + i); }
/// <summary> ///添加需要派发的信息的线程执行方法 /// </summary> static void yunxing() { int index = 0; while (true) { try { Thread.Sleep(1000); } catch (Exception e) { Console.WriteLine(e.Data); } if (index >= name.Length) { break; } EventWithValue ev = new EventWithValue(name[index], index); Delegate_Observe.Deob.Dispather <EventWithValue>(ev); index++; } }