protected virtual void OnRaiseCustomEvent(CustomEvent e) { EventHandler<CustomEvent> handler = RaiseCustomEvent; if (handler != null) { e.Message += String.Format(" at {0}", DateTime.Now.ToString()); handler(this, e); } }
protected virtual void OnRaiseCustomEvent(CustomEvent e) { EventHandler <CustomEvent> handler = RaiseCustomEvent; if (handler != null) { e.Message += String.Format(" at {0}", DateTime.Now.ToString()); handler(this, e); } }
public bool RemoveListener(CustomEvent eventName, EventDelegate oldListener) { if (listeners.ContainsKey(eventName)) { listeners[eventName] -= oldListener; return(true); } return(false); }
public void AddListener(CustomEvent eventName, EventDelegate newListener) { if (listeners.ContainsKey(eventName)) { listeners[eventName] += newListener; } else { listeners.Add(eventName, newListener); } }
public bool CallEvent(CustomEvent eventName, EventArgument argument) { if (listeners.ContainsKey(eventName)) { EventDelegate eventDelegate; listeners.TryGetValue(eventName, out eventDelegate); eventDelegate(argument); return(true); } return(false); }
void HandleCustomEvent(object sender, CustomEvent e) { Console.WriteLine(id + " received: {0}", e.Message); }
public override void customEventOccured(CustomEvent ce) { Console.WriteLine("Object with key: " + ce.Key + " has raised custom event."); }