public static bool Test(int N) { MyEventClass c = new MyEventClass(); for (int i = 0; i < NUM_LISTENERS; ++i) { MyClass l = new MyClass(); c.mEvent += new EventDelegate(l.Listener); } for (int i = 0; i < N; ++i) { MyClass.sCounter = 0; for (int j = 0; j < REPEAT; ++j) { c.RaiseEvent(42, 21); } if (MyClass.sCounter != NUM_LISTENERS * REPEAT) { return (false); } } return (true); }
public static void Main() { ConsoleKeyInfo cki; MyEventClass ec = new MyEventClass(); Show1 s = new Show1(); ec.KeyHit += new Handler(s.KeyShow); while (true) { if (Console.KeyAvailable) { cki = Console.ReadKey(true); if (cki.KeyChar == 'x') { break; } else { ec.OnKeyHit(cki.KeyChar); } } } }
public static bool Test(int N) { MyEventClass c = new MyEventClass(); for (int i = 0; i < NUM_LISTENERS; ++i) { MyClass l = new MyClass(); c.mEvent += new EventDelegate(l.Listener); } for (int i = 0; i < N; ++i) { MyClass.sCounter = 0; for (int j = 0; j < REPEAT; ++j) { c.RaiseEvent(42, 21); } if (MyClass.sCounter != NUM_LISTENERS * REPEAT) { return(false); } } return(true); }
public void ReplaceMyEventClass(MyEventClass newValue) { var index = GameComponentsLookup.MyEventClass; var component = (MyEventClassComponent)CreateComponent(index, typeof(MyEventClassComponent)); component.value = newValue; ReplaceComponent(index, component); }
public void AddMyEventClass(MyEventClass newValue) { var index = GameComponentsLookup.MyEventClass; var component = CreateComponent <MyEventClassComponent>(index); component.value = newValue; AddComponent(index, component); }
public static void Main( ) { MyEventClass MyObject = new MyEventClass( ); // AddHandler MyObject.MyEvent, AddressOf TestEvent.EventHandler MyObject.MyEvent += new MyEventClass.MyEventEventHandler(TestEvent.EventHandler); // Cause the object to raise an event. MyObject.CauseEvent(123); }
public static void Main() { MyClass mc = new MyClass(); MyClass2 mc2 = new MyClass2(); MyEventClass myEvent = new MyEventClass(); myEvent.EventName += new MyDelegate(mc.Show); myEvent.EventName += new MyDelegate(mc2.Show2); myEvent.OnEventName(); }
public void EventRaised() { c_0 generated = new c_0(); generated.raised = false; var subject = new MyEventClass(); subject.MyEvent += generated.m_1; subject.MethodThatRaisesMyEvent(); Assert.IsTrue(generated.raised); }