private void Vowel_Click(object sender, EventArgs e) { Socket socketSend = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); string messageTextBox = "vowel"; byte[] messageSentFromClient; try { // Retrive the Name of HOST string hostName = Dns.GetHostName(); // Get the IP string myIP = Dns.GetHostByName(hostName).AddressList[0].ToString(); socketSend.Connect(GlobalClient.iPEndPointSend); messageSentFromClient = Encoding.ASCII.GetBytes(messageTextBox + "$" + myIP + "#"); socketSend.Send(messageSentFromClient, SocketFlags.None); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.StackTrace + "\n" + ex.HelpLink + "\n" + ex.InnerException + "\n" + ex.Source + "\n" + ex.TargetSite); } finally { Player1Name.Focus(); } }
public Form2() { InitializeComponent(); //Check if client is player 1 and enable playe first if (GlobalClient.player1) { Vowel.Enabled = true; Consonant.Enabled = true; } TextClear.Enabled = false; Submit.Enabled = false; Player1Name.Text = GlobalClient.player1Name; Player2Name.Text = GlobalClient.player2Name; label3.Text = (GlobalClient.roundPlayed + 1).ToString(); Player1Name.Focus(); //Create new thread CheckForIllegalCrossThreadCalls = false; threadReceive = new Thread(new ThreadStart(ReceivedByClient)); threadReceive.Start(); }
private void tb1c_Tapped(object sender, TappedRoutedEventArgs e) { Player1Name.Text = ""; Player1Name.Focus(Windows.UI.Xaml.FocusState.Pointer); }