/// <summary>
        /// Load the project file.
        /// </summary>
        /// <param name="project">Project to load.</param>
        public void LoadProject(Project project)
        {
            Status = string.Format("Loading project {0}...", project.GetProjectFullPath());
            log.Debug(Status);
            _eventAggregator.PublishOnUIThreadAsync(new StatusMessageEvent(Status));

            // Only load the maximum number of configurations to see
            // all the configurations
            int numEns = project.GetNumberOfEnsembles();

            if (numEns > RTI.Commons.MAX_CONFIGURATIONS)
            {
                numEns = RTI.Commons.MAX_CONFIGURATIONS;
            }

            // Load all the configurations
            ViewSubsystemConfig prevConfig = null;

            for (int x = 1; x <= numEns; x++)
            {
                // Process the first 12 ensembles because there can only be up to 12 configurations
                ProcessEnsemble(project.GetEnsemble(x), EnsembleSource.Playback, AdcpCodec.CodecEnum.Binary);

                // Create subsystem config
                ViewSubsystemConfig config = new ViewSubsystemConfig(project.GetEnsemble(x).EnsembleData.SubsystemConfig, EnsembleSource.Playback);

                if (config != null)
                {
                    // Check if the config exist already
                    //if (!_dictSsConfig.ContainsKey(config))
                    {
                        // Only load new configs
                        if (config != prevConfig)
                        {
                            _dictSsConfig[config].LoadProject(project);
                        }

                        // Keep track of the previous config so we do not reload the same configuration
                        prevConfig = config;

                        Status = string.Format("Add configuration {0}", config.Config.DescString());
                        log.Debug(Status);
                        _eventAggregator.PublishOnUIThreadAsync(new StatusMessageEvent(Status));
                    }
                }
            }

            // Select the last config add
            SelectedSsConfigIndex = SsConfigList.Count();

            Status = string.Format("Add Project {0}", project.GetProjectFullPath());
            log.Debug(string.Format(Status));
            _eventAggregator.PublishOnUIThreadAsync(new StatusMessageEvent(Status));
        }
        /// <summary>
        /// Process the ensembles.  Look for new subsystem configurations with each ensemble.
        /// </summary>
        /// <param name="ensemble"></param>
        /// <param name="source"></param>
        /// <param name="dataFormat"></param>
        /// <returns></returns>
        public void ProcessEnsemble(Ensemble ensemble, EnsembleSource source, AdcpCodec.CodecEnum dataFormat)
        {
            if (ensemble != null && ensemble.IsEnsembleAvail)
            {
                // Create subsystem config
                ViewSubsystemConfig config = new ViewSubsystemConfig(ensemble.EnsembleData.SubsystemConfig, source);

                // Check if the config exist already
                if (!_dictSsConfig.ContainsKey(config))
                {
                    // Create the viewmodel for each subsystem config/source found
                    DashboardSubsystemConfigViewModel vm = new DashboardSubsystemConfigViewModel(config);

                    // Add the vm to the list
                    _dictSsConfig.Add(config, vm);

                    // Add to the list of subsystems
                    Application.Current.Dispatcher.Invoke((System.Action) delegate
                    {
                        SsConfigList.Add(vm);
                    });

                    log.Debug(string.Format("Add configuration {0}", config.Config.DescString()));

                    // Select the last config add
                    SelectedSsConfigIndex = SsConfigList.Count();

                    // Pass the ensemble to the viewmodel
                    vm.ProcessEnsemble(ensemble, source);

                    //return config;
                }
                else
                {
                    // Viewmodel already exist, so send the ensemble
                    //DashboardSubsystemConfigViewModel vm = null;
                    //if (_dictSsConfig.TryGetValue(config, out vm))
                    //{
                    //    vm.ProcessEnsemble(ensemble, source);
                    //}

                    //return config;
                }
            }

            // Not a valid ensemble
            //return null;
        }
Beispiel #3
0
        /// <summary>
        /// Initialize the dashboard subsystem VM.
        /// </summary>
        /// <param name="config"></param>
        public DashboardSubsystemConfigViewModel(ViewSubsystemConfig config)
        {
            Config = config;

            _windowMgr = IoC.Get <IWindowManager>();

            HeatmapPlot                 = IoC.Get <HeatmapPlotViewModel>();
            HeatmapPlot.IsShowMenu      = false;
            HeatmapPlot.IsShowStatusbar = false;
            HeatmapPlotExapnded         = null;

            ShipTrackGmapPlot                 = IoC.Get <ShipTrackGmapPlotViewModel>();
            ShipTrackGmapPlot.IsShowMenu      = false;
            ShipTrackGmapPlot.IsShowStatusbar = false;
            ShipTrackPlotExpanded             = null;

            ShipTrackPlot = IoC.Get <ShipTrackPlotViewModel>();

            TimeSeriesPlot                 = IoC.Get <TimeSeriesViewModel>();
            TimeSeriesPlot.IsShowMenu      = false;
            TimeSeriesPlot.IsShowStatusbar = false;
            TimeSeriesPlotExpanded         = null;

            TabularData         = IoC.Get <TabularViewModel>();
            TabularDataExpanded = null;

            Application.Current.Dispatcher.Invoke((System.Action) delegate
            {
                Profile3dPlot = IoC.Get <ProfilePlot3dViewModel>();
            });

            CorrelationPlot = IoC.Get <ProfilePlotViewModel>();
            CorrelationPlot.SetAxis(ProfilePlotViewModel.PlotType.PLOT_CORRELATION, false);

            AmplitudePlot = IoC.Get <ProfilePlotViewModel>();
            AmplitudePlot.SetAxis(ProfilePlotViewModel.PlotType.PLOT_AMPLITUDE, true);
        }