Exemplo n.º 1
0
 protected virtual void MessageHandler(IComponent sender, MessageEventArgs e)
 {
     Console.WriteLine("An error occurred while trying to forward an " + e.GetType() + " message");
     Console.WriteLine("\tMaybe an handler for " + e.GetType() + " is still not implemented!");
     Console.WriteLine("\tHowever, the message recived was: " + e);
 }
Exemplo n.º 2
0
 private void ForwardMessage(IComponent sender, MessageEventArgs e)
 {
     try
     {
         this.GetType().GetMethod("MessageHandler", searchFor, null, new Type[] { sender.GetType(), e.GetType() }, new ParameterModifier[0]).Invoke(this, new object[] { sender, e });
     }
     catch (Exception ex) { Console.WriteLine("Partita.ForwardMessage > a Reflection Exception occurred:\n" + ex.InnerException + "\n" + "trying to continue anyways..."); }
 }