public ConsoleScopa()
 {
     eventHandler = new ScopaEventHandler();
     eventHandler.MustThrowCard = delegate(Card card) {
         Console.Out.WriteLine("Deve tirare " + card);
     };
     eventHandler.MustTakeTrick = delegate(Card card) {
         Console.Out.WriteLine("Deve prendere con " + card);
     };
     eventHandler.UnableToThrow = delegate(Card card) {
         Console.Out.WriteLine("Non é possibile tirare " + card);
     };
     eventHandler.UnableToTakeTrick = delegate(Card card, List <Card> trick) {
         Console.Out.WriteLine("Non é possibile prendere " + Card.ToString(trick) + " con " + card);
     };
     eventHandler.UnableToThrow = delegate(Card card) {
         Console.Out.WriteLine("Non é possibile tirare " + card);
     };
     eventHandler.CardThrown = delegate(Card card) {
         Console.Out.WriteLine("Tira: " + card);
     };
     eventHandler.TrickTaken = delegate(Card card, List <Card> trick) {
         Console.Out.WriteLine("Ha preso: " + Card.ToString(trick) + " usa " + card);
     };
     eventHandler.Scopa = delegate(Card card, List <Card> trick) {
         Console.Out.WriteLine("Scopa!!!");
     };
 }
Exemple #2
0
 private void InitializeEventHandler()
 {
     eventHandler = new ScopaEventHandler();
     eventHandler.MustThrowCard += delegate(Card card) {
         MessageBox.Show("The " + card + " must be thrown", "Invalid Action", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     };
     eventHandler.MustTakeTrick += delegate(Card card) {
         MessageBox.Show("The " + card + " must take a trick", "Invalid Action", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     };
     eventHandler.UnableToThrow += delegate(Card card) {
         MessageBox.Show("The " + card + " can not be thrown", "Invalid Action", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     };
     eventHandler.UnableToTakeTrick += delegate(Card card, List <Card> list) {
         MessageBox.Show("The " + card + " can not take " + Card.ToString(list), "Invalid Action", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     };
     eventHandler.CardThrown += delegate(Card card) { };
     eventHandler.TrickTaken += delegate(Card card, List <Card> list) { };
     eventHandler.Scopa      += delegate(Card card, List <Card> list) {
         MessageBox.Show("Scopa!!!", "Scopa", MessageBoxButtons.OK);
     };
 }