Exemplo n.º 1
0
        public MainViewModel()
        {
            _IOProxy = new IOProxy(_SettingContainer);

            _SyncContext = SynchronizationContext.Current;

            CameraViewModel        = new CameraViewModel(this);
            SettingViewModel       = new SettingViewModel(this);
            DataPlotViewModel      = new DataPlotViewModel(this);
            CalibrationViewModel   = new CalibrationViewModel(this);
            RecordViewModel        = new RecordViewModel(this);
            ReplayViewModel        = new ReplayViewModel(this);
            DebugViewModel         = new DebugViewModel(this);
            VisualisationViewModel = new VisualisationViewModel(this);

            _DialogCoordinator = MahApps.Metro.Controls.Dialogs.DialogCoordinator.Instance;
        }
Exemplo n.º 2
0
        private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SettingViewModel svm     = (d as SettingViewModel);
            bool             changed = false;
            bool             connectionSettingsChanged = false;

            switch (e.Property.Name)
            {
            case "GyroscopeScale":
                changed = svm.Parent.SettingContainer.Settings.ImuSettings.GyroscopeScale != svm.GyroscopeScale;
                svm.Parent.SettingContainer.Settings.ImuSettings.GyroscopeScale = svm.GyroscopeScale;
                connectionSettingsChanged = false;
                break;

            case "AccelerometerScale":
                changed = svm.Parent.SettingContainer.Settings.ImuSettings.AccelerometerScale != svm.AccelerometerScale;
                svm.Parent.SettingContainer.Settings.ImuSettings.AccelerometerScale = svm.AccelerometerScale;
                connectionSettingsChanged = false;
                break;

            case "TemperatureOffset":
                changed = svm.Parent.SettingContainer.Settings.ImuSettings.TemperatureOffset != svm.TemperatureOffset;
                svm.Parent.SettingContainer.Settings.ImuSettings.TemperatureOffset = svm.TemperatureOffset;
                connectionSettingsChanged = false;
                break;

            case "TemperatureScale":
                changed = svm.Parent.SettingContainer.Settings.ImuSettings.TemperatureScale != svm.TemperatureScale;
                svm.Parent.SettingContainer.Settings.ImuSettings.TemperatureScale = svm.TemperatureScale;
                connectionSettingsChanged = false;
                break;

            case "SquaresX":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.SquaresX != svm.SquaresX;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.SquaresX = svm.SquaresX;
                break;

            case "SquaresY":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.SquaresY != svm.SquaresY;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.SquaresY = svm.SquaresY;
                break;

            case "SquareLength":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.SquareLength != svm.SquareLength;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.SquareLength = svm.SquareLength;
                break;

            case "MarkerLength":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.MarkerLength != svm.MarkerLength;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.MarkerLength = svm.MarkerLength;
                break;

            case "Dictionary":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.Dictionary != svm.Dictionary;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.ChArucoCalibrationSettings.Dictionary = svm.Dictionary;
                break;

            case "TagSize":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagSize != svm.TagSize;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagSize = svm.TagSize;
                connectionSettingsChanged = false;
                break;

            case "TagSpacingFactor":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagSpacingFactor != svm.TagSpacingFactor;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagSpacingFactor = svm.TagSpacingFactor;
                connectionSettingsChanged = false;
                break;

            case "TagsY":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagsY != svm.TagsY;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagsY = svm.TagsY;
                connectionSettingsChanged = false;
                break;

            case "TagsX":
                changed = svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagsX != svm.TagsX;
                svm.Parent.SettingContainer.Settings.CalibrationSettings.AprilGridCalibration.TagsX = svm.TagsX;
                connectionSettingsChanged = false;
                break;

            default:
                break;
            }
            if (changed)
            {
                svm.Parent.UpdateSettings(connectionSettingsChanged);
            }
        }