//public static void DoEvents() //{ // System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new Action(delegate { })); //} private void StartupConfig() { cmbIPs.ItemsSource = IPv4.GetActiveIP4s(); for (int port = 49200; port <= 49500; port++) { cmbPorts.Items.Add(port); } Config.GetConfig(out string myIP, out string serverIP, out int savedPort, out string myName); try { cmbIPs.SelectedItem = myIP; } catch { cmbIPs.SelectedItem = "127.0.0.1"; } try { cmbPorts.SelectedItem = savedPort; } catch { cmbPorts.SelectedItem = 49200; } txtServerIP.Text = serverIP; txtMyCar.Text = myName; btnConnectToServer.Visibility = Visibility.Visible; btnDisconnectFromServer.Visibility = Visibility.Hidden; grpMyCar.Visibility = Visibility.Hidden; }
private void StartupConfig() { cmbIPs.ItemsSource = IPv4.GetActiveIP4s(); for (int port = 49200; port <= 49500; port++) { cmbPorts.Items.Add(port); } Config.GetConfig(out string savedIP, out int savedPort); try { cmbIPs.SelectedItem = savedIP; } catch { cmbIPs.SelectedItem = "127.0.0.1"; } try { cmbPorts.SelectedItem = savedPort; } catch { cmbPorts.SelectedItem = 49200; } btnStartServer.Visibility = Visibility.Visible; btnStopServer.Visibility = Visibility.Hidden; grpCarPark.Visibility = Visibility.Hidden; }