Example #1
0
        public SteerVM(IFlightGearModel model)
        {
            this.model = model;

            this.model.PropertyChanged +=
                delegate(Object sender, PropertyChangedEventArgs e) { NotifyPropertyChanged("VM_" + e.PropertyName); };
        }
        //Constructor
        public GraphsViewModel(IFlightGearModel model)
        {
            _model = model;
            _model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                if (e.PropertyName == "Frames")
                {
                    _properties = new Dictionary <string, RandomVariable>();

                    foreach (var property in Frame.Properties)
                    {
                        var values = new List <double>();
                        foreach (var frame in _model.Frames)
                        {
                            values.Add(frame.ValuesMap[property]);
                        }

                        _properties[property] = new RandomVariable(values);
                    }
                }
                else if (e.PropertyName == "CurrentFramePosition")
                {
                    NotifyPropertyChanged(nameof(CurrentPropertyValues));
                    NotifyPropertyChanged(nameof(CurrentCorelativePropertyValues));
                    NotifyPropertyChanged(nameof(LinearRegressionLine));
                    NotifyPropertyChanged(nameof(LinearRegressionPoints));
                }
                else
                {
                    NotifyPropertyChanged(e.PropertyName);
                }
            };
        }
 public GeneralViewModel(IFlightGearModel model)
 {
     _model = model;
     _model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
     {
         NotifyPropertyChanged(e.PropertyName);
     };
 }
Example #4
0
 public DashBoardViewModel(IFlightGearModel model)
 {
     this.model             = model;
     model.PropertyChanged +=
         delegate(Object sender, PropertyChangedEventArgs e)
     {
         NotifyPropertyChanged("VM_" + e.PropertyName);
     };
 }
Example #5
0
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     this.myClient        = new MyClient();
     this.flightGearModel = new FlightGearModel(myClient);
     mainVM            = new MainViewModel(flightGearModel);
     mainWindow        = new MainWindow();
     loginWindow       = new LoginWindow();
     windowsController = new WindowsController();
     loginWindow.Show();
     loginWindow.connection_error.DataContext = windowsController;
 }
Example #6
0
 public void Application_New()
 {
     this.myClient        = new MyClient();
     this.flightGearModel = new FlightGearModel(myClient);
     mainVM = new MainViewModel(flightGearModel);
     mainWindow.Close();
     mainWindow = new MainWindow();
     loginWindow.Close();
     loginWindow       = new LoginWindow();
     windowsController = new WindowsController();
     loginWindow.Show();
 }
 //Constructor
 public PlayBackViewModel(IFlightGearModel model)
 {
     _model = model;
     _model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
     {
         if (e.PropertyName == "Frames")
         {
             NotifyPropertyChanged(nameof(FramesNumber));
         }
         else
         {
             NotifyPropertyChanged(e.PropertyName);
         }
     };
 }
Example #8
0
        //private bool connected;

        public MainWindow()
        {
            InitializeComponent();
            ipTextBox.Text   = ConfigurationManager.AppSettings["ip"];
            portTextBox.Text = ConfigurationManager.AppSettings["port"];


            this.model = new MyDashboardModel(null);
            vm         = new FlightGearViewModel(this.model);
            //SteerVM steerVM = new SteerVM(this.model);
            //MapVM mapVM = new MapVM(this.model);

            ////mapUC.DataContext = mapVM;
            //steerUC.DataContext = steerVM;
            //DataContext = vm;

            vm.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "VM_ErrorString")
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        errorWindow.Content  = vm.VM_ErrorString;
                        errorArea.Background = Brushes.Red;
                    });
                }
                if (e.PropertyName == "VM_Connected")
                {
                    if (vm.VM_Connected == true)
                    {
                        connectionStatus.Content    = "Connected";
                        connectionStatus.Foreground = Brushes.Green;
                        elipseConnectionStatus.Fill = Brushes.Green;
                        errorWindow.Content         = "";
                        errorArea.Background        = Brushes.Transparent;
                        //connected = true;
                    }
                    if (vm.VM_Connected == false)
                    {
                        connectionStatus.Content    = "Disconnected";
                        connectionStatus.Foreground = Brushes.Red;
                        elipseConnectionStatus.Fill = Brushes.Red;

                        //connected = false;
                    }
                }
            };
        }
Example #9
0
 //Constructor
 public RudderViewModel(IFlightGearModel model)
 {
     _model = model;
     model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
         if (e.PropertyName == "CurrentFramePosition")
         {
             NotifyPropertyChanged(nameof(Aileron));
             NotifyPropertyChanged(nameof(Elevator));
             NotifyPropertyChanged(nameof(Rudder));
             NotifyPropertyChanged(nameof(Throttle));
         }
         else
         {
             NotifyPropertyChanged(e.PropertyName);
         }
     };
 }
Example #10
0
 //Constructor
 public StatisticsViewModel(IFlightGearModel model)
 {
     _model = model;
     model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
         if (e.PropertyName == "CurrentFramePosition")
         {
             NotifyPropertyChanged(nameof(Altimeter));
             NotifyPropertyChanged(nameof(AirSpeed));
             NotifyPropertyChanged(nameof(Direction));
             NotifyPropertyChanged(nameof(Pitch));
             NotifyPropertyChanged(nameof(Roll));
             NotifyPropertyChanged(nameof(Yaw));
         }
         else
         {
             NotifyPropertyChanged(e.PropertyName);
         }
     };
 }
 public SimulatorViewModel(IFlightGearModel m)
 {
     this.simulatorModel = m;
     this.dict           = new Dictionary <int, string>();
     this.simulatorModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
     {
         if (e.PropertyName.Equals("DashboardInfo") && simulatorModel.ServerConnected())
         {
             this.VM_dashboardInfo = this.simulatorModel.DashboardInfo;
             for (int i = 0; i < 8; i++)
             {
                 this.NotifyPropertyChanged(this.dict[i]);
             }
         }
         if (e.PropertyName.Equals("PositionInfo"))
         {
             this.coordinates = this.simulatorModel.GetPosition();
         }
         NotifyPropertyChanged("VM_" + e.PropertyName);
     };
     NotifyPropertyChanged("VM_PositionInfo");
     DashBoardProperties();
 }
 //Constructor, setting the app model
 public ControllersViewModel(IFlightGearModel model)
 {
     this.model = model;
 }
Example #13
0
 //Constructor that intizalizing all the view models with the given model.
 public MainViewModel(IFlightGearModel flightGearModel)
 {
     this.dashVM       = new DashBoardViewModel(flightGearModel);
     this.mapVM        = new MapViewModel(flightGearModel);
     this.controllerVM = new ControllersViewModel(flightGearModel);
 }
Example #14
0
 public MapVM(IFlightGearModel model)
 {
     this.model = model;
 }