/// <summary> /// Shutdown the VM. /// </summary> public void Dispose() { while (_dictSsConfig.Count > 0) { // Set the next config _SelectedSsConfig = _dictSsConfig.Values.First(); // Close the tab CloseTab(); } }
/// <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; }