Beispiel #1
0
        public MainViewModel(ModelContainer modelContainer)
        {
            this.modelContainer = modelContainer;
            TopBarViewModel     = new TopBarViewModel(modelContainer);
            _IMUViewModel       = new IMUViewModel(modelContainer);
            _StatusViewModel    = new StatusViewModel(modelContainer);
            _ControlViewModel   = new ControlViewModel(modelContainer);
            _AutonomyViewModel  = new AutonomyViewModel(modelContainer);
            SelectedViewModel   = _ControlViewModel;

            ConnectedToJetson = modelContainer.modelStatus.networkStatus.ConnectedToJetson;
            modelContainer.modelStatus.networkStatus.ConnectedToJetsonCallback += (val) => { ConnectedToJetson = val; };

            modelContainer.dataContainer.Battery.newDataCallback += (float v1, float v2) => { Battery1Voltage = v1; Battery2Voltage = v2; };
            ChangeViewCommand = new RelayCommand(ChangeViewAction, AlwaysAllow);
            ExpandMenuCommand = new RelayCommand(ExpandMenuAction, AlwaysAllow);

            ConnectToJetsonCommand      = new RelayCommand(ConnectToJetsonAction, AlwaysAllow);
            DisconnectFromJetsonCommand = new RelayCommand(DisconnectFromJetsonAction, AlwaysAllow);
            OpenSettingsCommand         = new RelayCommand(OpenSettingsAction, AlwaysAllow);
            //SettingsDialogHideCommand = new RelayCommand(SettingsDialogHideAction, AlwaysAllow);
            Battery1Voltage = 12.9;
            Battery2Voltage = 12.2;
            modelContainer.userSettings.SettingsChangedCallback += () => {
                RaisePropertyChanged("Battery1Voltage");
                RaisePropertyChanged("Battery1Percent");
                RaisePropertyChanged("Battery2Voltage");
                RaisePropertyChanged("Battery2Percent");
                RaisePropertyChanged("Battery1Allert");
                RaisePropertyChanged("Battery2Allert");
            };
        }
Beispiel #2
0
        public MainViewModel()
        {
            ModelContainer modelContainer = new ModelContainer();

            _ControlViewModel = new ControlViewModel(modelContainer);
            _IMUViewModel     = new IMUViewModel(modelContainer);
            SelectedViewModel = _StatusViewModel;
        }