Пример #1
0
 void client1_GetPlayerByNameCompleted(object sender, ServiceReference1.GetPlayerByNameCompletedEventArgs e)
 {
     me   = e.Result;
     host = new ServiceReference1.Player()
     {
         PlayerId = data.PlayerID, PlayerName = data.PlayerName
     };
     client1.JoinLobbyRoomCompleted += client1_JoinLobbyRoomCompleted;
     client1.JoinLobbyRoomAsync(me, host);
 }
Пример #2
0
 void client1_GetPlayerCompleted(object sender, ServiceReference1.GetPlayerCompletedEventArgs e)
 {
     try
     {
         client1.CreateLobbyCompleted += client1_CreateLobbyCompleted;
         me = e.Result;
         client1.CreateLobbyAsync(me);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Пример #3
0
 void client1_GetPlayerByNameCompleted(object sender, ServiceReference1.GetPlayerByNameCompletedEventArgs e)
 {
     try
     {
         me = e.Result;
         //host = new ServiceReference1.Player() { PlayerId = data.PlayerID, PlayerName = data.PlayerName };
         client1.JoinLobbyRoomCompleted += client1_JoinLobbyRoomCompleted;
         client1.JoinLobbyRoomAsync(me, host);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\n" + ex.Data + "\n" + ex.InnerException);
     }
 }
        private void Add_Click_1(object sender, RoutedEventArgs e)
        {
            try
            {
                client1.AddPlayerCompleted += client_AddPlayerCompleted;
                p            = new ServiceReference1.Player();
                p.PlayerId   = int.Parse(ID.Text);
                p.PlayerName = Name.Text;

                client1.AddPlayerAsync(p);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #5
0
 private void lstbox2_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         data = (DataObjects)((ListBox)(sender)).SelectedItem;
         host = new ServiceReference1.Player()
         {
             PlayerId = data.PlayerID, PlayerName = data.PlayerName
         };
         client1.GetPlayerByNameCompleted += client1_GetPlayerByNameCompleted;
         client1.GetPlayerByNameAsync(MyName);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.InnerException.ToString());
     }
 }
Пример #6
0
        void client1_GetPlayerByIdCompleted(object sender, ServiceReference1.GetPlayerByIdCompletedEventArgs e)
        {
            try
            {
                if (e.Result != null)
                {
                    staticHost = e.Result;

                    client1.StartGameCompleted += client1_StartGameCompleted;
                    client1.StartGameAsync(staticHost);
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex)
            {
                // MessageBox.Show(ex.InnerException + "\n\n" + ex.StackTrace);
                MessageBox.Show(ex.Message);
            }
        }
Пример #7
0
 void client1_GetPlayerByNameCompleted(object sender, ServiceReference1.GetPlayerByNameCompletedEventArgs e)
 {
     try
     {
         me = e.Result;
         //host = new ServiceReference1.Player() { PlayerId = data.PlayerID, PlayerName = data.PlayerName };
         client1.JoinLobbyRoomCompleted += client1_JoinLobbyRoomCompleted;
         client1.JoinLobbyRoomAsync(me, host);
     }
     catch (WebException ex)
     {
         MessageBox.Show("Please turn on the internet" + "\n" + ex.Response.ToString() + "\n" + ex.Message.ToString());
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("please be sure you entered an Nickname");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\n" + ex.Data + "\n" + ex.InnerException);
     }
 }
Пример #8
0
 void client1_GetPlayerCompleted(object sender, ServiceReference1.GetPlayerCompletedEventArgs e)
 {
     client1.CreateLobbyCompleted += client1_CreateLobbyCompleted;
     me = e.Result;
     client1.CreateLobbyAsync(me);
 }