コード例 #1
0
 void btnLogin_Click(object sender, RoutedEventArgs e)
 {
     if (tbName.Text.Length >= 3)
     {
         Socket.client.Emit("playerlist", null);
         while (!Socket.playerListIsBuild)
         {
             tbName.Visibility          = System.Windows.Visibility.Hidden;
             btnLogin.Visibility        = System.Windows.Visibility.Hidden;
             lblUsername.Visibility     = System.Windows.Visibility.Hidden;
             lblNotification.Visibility = System.Windows.Visibility.Visible;
             lblNotification.Content    = "Fetching playerlist.";
         }
         if (!Socket.playerlist.Contains(tbName.Text.ToString()))
         {
             Socket.client.Emit("initializeplayer", tbName.Text);
             this.Close();
             MessageBox.Show("Welcome " + tbName.Text + "!", "Welcome");
             lob.Show();
         }
         else
         {
             MessageBox.Show("Playername already exists", "Error!");
             lblNotification.Visibility = System.Windows.Visibility.Hidden;
             tbName.Visibility          = System.Windows.Visibility.Visible;
             btnLogin.Visibility        = System.Windows.Visibility.Visible;
             lblUsername.Visibility     = System.Windows.Visibility.Visible;
         }
     }
     else
     {
         MessageBox.Show("Username " + tbName.Text + " is to short", "Error!");
     }
 }
コード例 #2
0
ファイル: GameRoom.xaml.cs プロジェクト: royb3/pong
 void GameRoom_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Lobby lob = new Lobby();
     lob.Show();
 }
コード例 #3
0
ファイル: GameRoom.xaml.cs プロジェクト: royb3/pong
        void GameRoom_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Lobby lob = new Lobby();

            lob.Show();
        }