private void Button_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(name_text.Text) && !string.IsNullOrWhiteSpace(ip_text.Text)) { game g = new game(); g.name = name_text.Text; g.ipaddress = ip_text.Text; g.Show(); this.Hide(); } }
private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (!string.IsNullOrWhiteSpace(name_text.Text) && !string.IsNullOrWhiteSpace(ip_text.Text)) { game g = new game(); g.name = name_text.Text; g.ipaddress = ip_text.Text; g.Show(); this.Hide(); } } }