/// <summary> /// Handle event when BulkEnsembleEvent is received. /// This will create the displays for each config /// if it has not been created already. It will also /// display the latest ensemble. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public override void Handle(BulkEnsembleEvent ensEvent) { _buffer.Enqueue(ensEvent); // Execute async if (!_isProcessingBuffer) { // Execute async Task.Run(() => BulkEnsembleDisplayExecute()); } }
/// <summary> /// Display the bulk ensemble event async. /// </summary> private void BulkEnsembleDisplayExecute(BulkEnsembleEvent ensEvent) { // Find all the configurations for (int x = 0; x < ensEvent.Ensembles.Count(); x++) { // There can only be 12 configurations if (x > 12) { break; } // Get the ensemble DataSet.Ensemble ens = ensEvent.Ensembles.IndexValue(x); // Verify the ensemble if (ens != null && ens.IsEnsembleAvail) { // Create the config var ssDataConfig = new SubsystemDataConfig(ens.EnsembleData.SubsystemConfig, ensEvent.Source); // Check if the config exist in the table if (!_validationTestVMDict.ContainsKey(ssDataConfig)) { Application.Current.Dispatcher.BeginInvoke(new System.Action(() => AddConfig(ssDataConfig))); } //Wait for the dispatcher to add the config // Monitor for any timeouts int timeout = 0; while (!_validationTestVMDict.ContainsKey(ssDataConfig)) { // Set a timeout and wait for the config timeout++; if (timeout > 10) { break; } System.Threading.Thread.Sleep(250); } //_events.PublishOnUIThread(new EnsembleEvent(ens, EnsembleSource.Playback)); } } // Pass the ensembles to the displays foreach (var vm in _validationTestVMDict.Values) { vm.DisplayBulkData(ensEvent.Ensembles); } }
/// <summary> /// Display the bulk ensemble event async. /// </summary> private void BulkEnsembleDisplayExecute() { while (_buffer.Count > 0) { _isProcessingBuffer = true; BulkEnsembleEvent ensEvent = null; if (_buffer.TryDequeue(out ensEvent)) { //// Set the maximum display for each VM //foreach (var vm in GraphicalVMList) //{ // vm.ClearPlots(); // vm.DisplayMaxEnsembles = ensEvent.Ensembles.Count(); //} // Look for all the configurations // 12 is maximum configurations if (ensEvent.Ensembles.Count() > 0) { for (int x = 0; x < ensEvent.Ensembles.Count(); x++) { // Check 12 ensembles, because there can be up to 12 different configurations if (x > 12) { break; } var ensemble = ensEvent.Ensembles.IndexValue(x); // Verify the ensemble if (ensemble != null && ensemble.IsEnsembleAvail) { // Create the config var ssDataConfig = new SubsystemDataConfig(ensemble.EnsembleData.SubsystemConfig, ensEvent.Source); // Check if the config exist in the table if (!_graphicalVMDict.ContainsKey(ssDataConfig)) { Application.Current.Dispatcher.BeginInvoke(new System.Action(() => AddConfig(ssDataConfig))); } //Wait for the dispatcher to add the config // Monitor for any timeouts int timeout = 0; while (!_graphicalVMDict.ContainsKey(ssDataConfig)) { // Set a timeout and wait for the config timeout++; if (timeout > 10) { break; } System.Threading.Thread.Sleep(250); } } } // Get the number of ensembles and use it to set the max display int maxEnsembles = 0; if (_pm.IsProjectSelected) { maxEnsembles = _pm.SelectedProject.GetNumberOfEnsembles(); } // Pass the ensembles to the displays foreach (var vm in _graphicalVMDict.Values) { vm.DisplayBulkData(ensEvent.Ensembles, maxEnsembles); } } } } _isProcessingBuffer = false; }
/// <summary> /// Bulk ensemble event. /// </summary> /// <param name="ensEvent"></param> public override void Handle(BulkEnsembleEvent ensEvent) { // Do Nothing }
/// <summary> /// Bulk Ensemble event. /// </summary> /// <param name="ensEvent"></param> public override void Handle(BulkEnsembleEvent ensEvent) { // DO NOTHING }
/// <summary> /// Handle a Bulk Ensemble Event. /// </summary> /// <param name="ensEvent">Event containing the bulk ensembles.</param> public abstract void Handle(BulkEnsembleEvent ensEvent);
/// <summary> /// Handle event when BulkEnsembleEvent is received. /// This will create the displays for each config /// if it has not been created already. It will also /// display the latest ensemble. /// </summary> /// <param name="ensEvent">Ensemble event.</param> public override void Handle(BulkEnsembleEvent ensEvent) { // Execute async Task.Run(() => BulkEnsembleDisplayExecute(ensEvent)); }