private void ButtonClick(object sender, RoutedEventArgs e) { int port = Int32.Parse(this.port_text_box.Text); try { myFlight.Connect(this.ip_textbox.Text, port); } catch (Exception) { Label l = new Label { Content = "Connection failure", FontSize = 20, Foreground = Brushes.Red, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; Grid.SetRow(l, 2); Grid.SetColumnSpan(l, 2); myGrid.Children.Add(l); return; } Thread t = new Thread(new ThreadStart(myFlight.Start)); t.Start(); this.Hide(); myMain.Show(); }
private void OnClick() { // Send connect command to model. model.Connect(Settings.Default.FlightServerIP, Settings.Default.FlightInfoPort, Settings.Default.FlightCommandPort); }