private void play_Click(object sender, RoutedEventArgs e) { if (detectFilePath == null) { MessageBox.Show("Load a flight that you want to detect!"); } else if (properFilePath == null) { MessageBox.Show("Load a proper flight!"); } else if (stopFlag) { vm = null; // creating new instance of vm vm = new FlightGearViewModel(new MyFlightGearModel(new MyTelnetClient())); DataContext = vm; playFlag = false; stopFlag = false; vm.VM_connect("localhost", 5400); playFlag = true; vm.VM_start(); } else if (!playFlag) { vm.VM_connect("localhost", 5400); vm.VM_start(); playFlag = true; } else // pauseFlag is pressed { playFlag = true; vm.VM_resume(); } }
public MainWindow() { InitializeComponent(); vm = new FlightGearViewModel(new MyFlightGearModel(new MyTelnetClient())); DataContext = vm; playFlag = false; stopFlag = false; PropertiesList.DataContext = vm; dllFilePath = null; }