private void Connect(object sender, RoutedEventArgs e) { SimulatorWindow sw = new SimulatorWindow(); sw.Show(); this.Close(); }
/// <summary> /// Connecting to server after "Connect" button is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void connectButton_Click(object sender, RoutedEventArgs e) { try { //connect to server this.fs_ViewModel.connect(); //open simulator window SimulatorWindow objSimulator = new SimulatorWindow(model); objSimulator.wheelsControl.DataContext = new WheelsControlVM(this.model); this.Visibility = Visibility.Hidden; //matching data context to VM objSimulator.DataContext = fs_ViewModel; objSimulator.Show(); this.Close(); } catch (Exception exception) { this.errorLabel.Visibility = Visibility.Visible; } }