Ejemplo 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;
        }
Ejemplo n.º 2
0
        private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataPlotViewModel dpvm = (d as DataPlotViewModel);
            bool changed           = false;

            switch (e.Property.Name)
            {
            case "Enabled":
                changed = dpvm.Parent.SettingContainer.Settings.StreamingSettings.ImuRawStreamEnabled != dpvm.Enabled;
                dpvm.Parent.SettingContainer.Settings.StreamingSettings.ImuRawStreamEnabled = dpvm.Enabled;
                try
                {
                    if (dpvm.Enabled)
                    {
                        dpvm.Parent.IOProxy.Subscribe(dpvm, ProxyEventType.ImuEvent);
                    }
                    else
                    {
                        dpvm.Parent.IOProxy.Unsubscribe(dpvm, ProxyEventType.ImuEvent);
                    }
                }
                catch (Exception) { }
                break;

            case "RecordRemote":
                changed = dpvm.Parent.SettingContainer.Settings.ImuSettings.RecordRemote != dpvm.RecordRemote;
                dpvm.Parent.SettingContainer.Settings.ImuSettings.RecordRemote = dpvm.RecordRemote;
                break;

            default:
                break;
            }
            if (changed)
            {
                dpvm.Parent.UpdateSettings(false);
            }
        }