private void LaunchButton_Click(object sender, RoutedEventArgs rea) { //Port try { controller.port = Int32.Parse(PortStarter.Text); } catch (FormatException e) { PortStarter.Text = ""; return; } controller.nickname = NameStarter.Text; controller.ipAddress = (string)IpStarter.SelectedValue; //New Address ip if (ContainNode.IsChecked.Value) { int portNode = -1; try { portNode = Int32.Parse(PortNode.Text); } catch (FormatException e) { PortNode.Text = ""; return; } controller.addParticipant(NameNode.Text); controller.addPair(new Pair(AddressIpNode.Text, portNode)); } Hide(); new MainWindow(controller).Show(); }