Exemplo n.º 1
0
 static void AddPlayers()
 {
     IPlayerManipulations playerLogic = new PlayerLogic();
     // add players
     Console.WriteLine("-> adding players...");
     Console.WriteLine("\t\t#Method AddOrUpdatePlayer()");
     playerLogic.AddOrUpdatePlayer(new PlayerType("*****@*****.**", "Jonas", "Jonas_tag"));
     playerLogic.AddOrUpdatePlayer(new PlayerType("*****@*****.**", "Lien", "Lien_tag"));
     playerLogic.AddOrUpdatePlayer(new PlayerType("*****@*****.**", "Bart", "Bart_tag"));
     playerLogic.AddOrUpdatePlayer(new PlayerType("*****@*****.**", "Yana", "Yana_tag"));
     // print players
     Console.WriteLine("\t\t#Method PlayerType.ToString()");
     Console.WriteLine("------- Players -------");
     foreach (PlayerType p in playerLogic.GetPlayers())
     {
         Console.WriteLine("  " + p.ToString());
     }
     Console.WriteLine("------- @@@@@ -------\n\n");
     // wait for user
     Wait();
 }
Exemplo n.º 2
0
 private void btnAddPlayer_Click(object sender, EventArgs e)
 {
     IPlayerManipulations playerLogic = new PlayerLogic();
     if (tbAddPlayerName.Text != "")
     {
         try
         {
             playerLogic.AddOrUpdatePlayer(new PlayerType(tbAddPlayerMail.Text, tbAddPlayerName.Text, tbAddPlayerTag.Text));
             tbAddPlayerMail.Text = "";
             tbAddPlayerName.Text = "";
             tbAddPlayerTag.Text = "";
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error: Add Player", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Player needs a name.", "Error: Add Player", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     UpdatePlayerList();
     UpdateTree();
 }