Beispiel #1
0
 private void HandleNameMenuItemForPlayer2(object sender, RoutedEventArgs e)
 {
     SetNameWindow dialog = new SetNameWindow();
     dialog.Owner = player2Window;
     dialog.ShowDialog();
     string name = dialog.GetName();
     handler.SendRequest(string.Format("SET_NAME,{0}", name));
     string response = handler.GetResponse();
     if (response == "OKAY")
     {
         player2Name = name;
     }
 }
Beispiel #2
0
 private void HandleNameMenuItemForPlayer1(object sender, RoutedEventArgs e)
 {
     SetNameWindow dialog = new SetNameWindow();
     dialog.Owner = player1Window;
     dialog.ShowDialog();
     string name = dialog.GetName();
     handler.SendRequest(string.Format("SET_NAME,{0}", name));
     string response = handler.GetResponse();
     if (response != "ERROR")
     {
         player1Name = name;
         player1Window.SetStatus("player name accepted");
         timer.Tick += timer_TickPlayer1;
     }
     else
     {
         player1Window.SetStatus("player name not accepted, try again...");
     }
 }