public DashboardViewModel(FlightSimulatorModel model) { flightSimulatorModel = model; flightSimulatorModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
public void ApplicationDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { if (e != null) { FlightSimulatorModel.Get().ThrowNewError(e.Exception.Message); e.Handled = true; } }
public DashBaordViewModel() { this.model = (Application.Current as App).Model;; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
public GraphsAndListViewModel() { model = FlightSimulator.ModelInstance; model.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); }; }
public VMContainer() { this.fsmodel = new FlightSimulatorModel(); this.fsmodel.connect(); this.vm1 = new PlayControllerViewModel(this.fsmodel); this.vm2 = new JoystickControllerViewModel(this.fsmodel); this.vm3 = new StatDisplayViewModel(this.fsmodel); //this.vm4 = new GraphDisplayViewModel(this.fsmodel); }
private void Application_Startup(object sender, StartupEventArgs e) { Model = new FlightSimulatorModel(new MySimulatorConnector()); JoystickVM = new MyJoystickViewModel(); DashVM = new DashBaordViewModel(); SBVM = new StatusBarViewModel(); SVM = new SettingsViewModel(); // Create main application window MainWindow mainWindow = new MainWindow(); mainWindow.Show(); }
private void Application_Startup(Object sender, StartupEventArgs e) { model = new FlightSimulatorModel(new MyTelnetClient()); flightSimulatorViewModel = new FlightSimulatorViewModel(model); manualControlsViewModel = new ManualControlsViewModel(model); dashboardViewModel = new DashboardViewModel(model); mapControlViewModel = new MapControlViewModel(model); Window mainWindow = new MainWindow(); mainWindow.Show(); }
private static Command ChooseCommand() { if (FlightSimulatorModel.Get().PriorityQueue.Count != 0) { return(FlightSimulatorModel.Get().PriorityQueue.Dequeue()); } else if (FlightSimulatorModel.Get().Queue.Count != 0) { return(FlightSimulatorModel.Get().Queue.Dequeue()); } else { return(null); } }
private void Application_Exit(object sender, ExitEventArgs e) { FlightSimulatorModel.ExitProgram(); }
public override string getValue() { return(FlightSimulatorModel.Get().GetDataByKey(path())); }
// methods public MyJoystickViewModel() { this.model = (Application.Current as App).Model; }
public BaseNotify() { Model = FlightSimulatorModel.Get(); }
//create a tcp server with the default _port and _ip public static void CreateAndRunClient(NetworkStream stream) { try { if (stream == null) { return; } Byte[] data = null; // Get a client stream for reading and writing. // Stream stream = client.GetStream(); if (!_runClient) { FlightSimulatorModel.Get().ThrowNewError("Oops! you got runclient problem"); return; } while (_runClient) { // Translate the passed message into ASCII and store it as a Byte array. Command c = ChooseCommand(); if (c == null) { continue; } data = System.Text.Encoding.ASCII.GetBytes(c.execute()); // Send the message to the connected TcpServer. stream.Write(data, 0, data.Length); data = new Byte[256]; // String to store the response ASCII representation. String responseData = String.Empty; // Read the first batch of the TcpServer response bytes. Thread.Sleep(30); stream.ReadTimeout = 15000; Int32 bytes = stream.Read(data, 0, data.Length); responseData = System.Text.Encoding.ASCII.GetString(data, 0, bytes); responseData = responseData.Substring(0, responseData.Length - 1); FlightSimulatorModel.Get().UpdateValueMap(c.path(), responseData); } // Close everything stream.Close(); //MyTcpClient.client.Close(); } catch (IOException e) { if (stream != null) { stream.Close(); } //MyTcpClient.client.Close(); ThreadAlreadyRunning = false; FlightSimulatorModel.Get().ThrowNewError("Connection to the server was lost\r\nPlease insert IP and Port in the connection tab\r\n" + e.Message); _ip = String.Empty; _port = 0; } finally { _runClient = true; M.Set(); } }
public MainWindow() { InitializeComponent(); new Thread(FlightSimulatorModel.Get().InitRunBackground).Start(); }