public List <string> StartConvertToJpeg(OnProcessEvent callback) { this.callback = callback; m_threadJpeg = new Thread(ExtractMultiframes2Singleframe); m_threadJpeg.Start(); return(JpegFileList); }
/// <summary> /// Adds new uninitialized event processors instances to this hub. /// </summary> /// /// <param name="amount">The amount of event processors to add.</param> /// public void AddEventProcessors(int amount) { for (int i = 0; i < amount; i++) { var eventProcessor = new ShortWaitTimeMock ( InnerPartitionManager, ConsumerGroup, FullyQualifiedNamespace, EventHubName, ConnectionFactory, ClientOptions ); if (OnInitialize != null) { eventProcessor.PartitionInitializingAsync += eventArgs => { OnInitialize(eventArgs); return(Task.CompletedTask); }; } if (OnStop != null) { eventProcessor.PartitionClosingAsync += eventArgs => { OnStop(eventArgs); return(Task.CompletedTask); }; } eventProcessor.ProcessEventAsync += eventArgs => { OnProcessEvent?.Invoke(eventArgs); return(Task.CompletedTask); }; eventProcessor.ProcessErrorAsync += eventArgs => { OnProcessError?.Invoke(eventArgs); return(Task.CompletedTask); }; EventProcessors.Add(eventProcessor); } }
/// <summary> /// Adds new uninitialized event processors instances to this hub. /// </summary> /// /// <param name="amount">The amount of event processors to add.</param> /// public void AddEventProcessors(int amount) { for (int i = 0; i < amount; i++) { var eventProcessor = new ShortWaitTimeMock ( ConsumerGroup, InnerPartitionManager, Connection, Options ); if (OnInitialize != null) { eventProcessor.InitializeProcessingForPartitionAsyncHandler = initializationContext => { OnInitialize(initializationContext); return(new ValueTask()); }; } if (OnStop != null) { eventProcessor.ProcessingForPartitionStoppedAsyncHandler = stopContext => { OnStop(stopContext); return(new ValueTask()); }; } eventProcessor.ProcessEventAsyncHandler = processorEvent => { OnProcessEvent?.Invoke(processorEvent); return(new ValueTask()); }; eventProcessor.ProcessErrorAsyncHandler = errorContext => { OnProcessException?.Invoke(errorContext); return(new ValueTask()); }; EventProcessors.Add(eventProcessor); } }
public void Execute(OnProcessEvent pipelineEvent) { var state = pipelineEvent.Pipeline.State; var projectionEvent = state.GetProjectionEvent(); var eventEnvelope = state.GetEventEnvelope(); var projection = state.GetProjection(); var domainEvent = state.GetEvent(); Guard.AgainstNull(projectionEvent, nameof(projectionEvent)); if (!projectionEvent.HasPrimitiveEvent) { return; } Guard.AgainstNull(eventEnvelope, nameof(eventEnvelope)); Guard.AgainstNull(projection, nameof(projection)); Guard.AgainstNull(domainEvent, nameof(domainEvent)); projection.Process(eventEnvelope, domainEvent, projectionEvent.PrimitiveEvent, state.GetThreadState()); }
private void OnRead(IAsyncResult ar) { if (!CompleteRead(ar)) { return; } try { OnProcessEvent?.Invoke(this, InMessage); OnPostProcessEvent?.Invoke(this); } catch (Exception e) { // Invalid data from the client // TODO: I must not swallow exceptions. Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); // TODO: is closing the connection really necesary? // Close(); } }
public void StartConvertToAVI(OnProcessEvent callback) { this.callback = callback; m_threadAvi = new Thread(ConvertDicom2AVIFormat); m_threadAvi.Start(); }
private void OnProcessHandle(int layerIndex, IntPtr data, int width, int height, int outputIndex) { OnProcessEvent?.Invoke(layerIndex, data, width, height, outputIndex); }