EventProcessor

We found 10 examples in language CSharp for this search. You will see 20 fragments of code.

	void OnEnable()
	{
		if(UnityTuioManager.Instance != null)
		{
			if(UnityTuioManager.Instance.EventProcessor == null)
			{
				UnityTuioManager.Instance.OnTrackingInitialized += SubscribeTrackingEvents;
			}
			else
			{
				SubscribeTrackingEvents(this, null);
			}
		}
	}


	void OnEnable()
	{
		if(UnityTuioManager.Instance != null)
		{
			if(UnityTuioManager.Instance.EventProcessor == null)
			{
				UnityTuioManager.Instance.OnTrackingInitialized += SubscribeTrackingEvents;
			}
			else
			{
				SubscribeTrackingEvents(this, null);
			}
		}
	}

	#endregion

	#region private methods
	private void SubscribePharusTrackingEvents(object theSender, System.EventArgs e)
	{
		UnityPharusManager.Instance.EventProcessor.TrackAdded += OnTrackAdded;
		UnityPharusManager.Instance.EventProcessor.TrackUpdated += OnTrackUpdated;
		UnityPharusManager.Instance.EventProcessor.TrackRemoved += OnTrackRemoved;
	}


        public static IEventProcessor GetEventProcessor()
        {
            return eventProcessor;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="eventProcessor">Non null object</param>
        public static void InjectEventProcessor(IEventProcessor eventProcessor)
        {
            Framework.eventProcessor = eventProcessor;
        }


        public static void Replay(IEventSaver eventSaver, IEventProcessor eventProcessor)
        {
            Replay(eventSaver, eventProcessor, Framework.GetControlGateway());
        }


        /// <summary>
        /// 添加记录器
        /// </summary>
        /// <param name="eventProcessor">日志记录器</param>
        public static void AddEventProcessor(BaseEventProcessor eventProcessor) {
            if (!ProcessorList.Contains(eventProcessor))
                ProcessorList.Add(eventProcessor);
        }

        /// <summary>
        /// 移除记录器
        /// </summary>
        /// <param name="eventProcessor">日志记录器</param>
        public static void RemoveEventProcessor(BaseEventProcessor eventProcessor) {
            if (ProcessorList.Contains(eventProcessor))
                ProcessorList.Remove(eventProcessor);
        }


        public void Add(IEventProcessor eventProcessor, IEventHandler<T> eventHandler, ISequenceBarrier sequenceBarrier)
        {
            var eventProcessorInfo = new EventProcessorInfo<T>(eventProcessor, eventHandler, sequenceBarrier);
            _eventProcessorInfoByHandler[eventHandler] = eventProcessorInfo;
            _eventProcessorInfoByEventProcessor[eventProcessor] = eventProcessorInfo;
        }

        public IEventProcessor GetEventProcessorFor(IEventHandler<T> eventHandler)
        {
            var eventProcessorInfo = _eventProcessorInfoByHandler[eventHandler];
            if(eventProcessorInfo == null)
            {
                throw new ArgumentException("The event handler " + eventHandler + " is not processing events.");
            }

            return eventProcessorInfo.EventProcessor;
        }

        public void UnmarkEventProcessorsAsEndOfChain(IEnumerable<IEventProcessor> eventProcessors)
        {
            foreach (var eventProcessor in eventProcessors)
            {
                _eventProcessorInfoByEventProcessor[eventProcessor].MarkAsUsedInBarrier();
            }
        }


        private void OnSerialLineStateChangedEvent(object sender, CommunicationStateChangeEvent e)
        {
            eventProcessor.OnStateChanged(e.State);
        }

        private void OnSerialLineErrorEvent(object sender, CommunicationErrorEvent e)
        {
            serialLine.Disconnect();
            eventProcessor.OnCatchException(new Exception("Устройство отключено"));
        }

        private void OnSerialLineReceiveEvent(object sender, CommunicationReceiveEvent e)
        {
            try
            {
                if (isReceiveData)
                    return;

                receiveData = e.Buffer;
                isReceiveData = true;
            }
            catch (Exception ex)
            {
                isReceiveData = false;
                eventProcessor.OnCatchException(ex);
            }
        }


        private void OnSerialLineStateChangedEvent(object sender, CommunicationStateChangeEvent e) {
            eventProcessor.OnStateChanged(e.State);
        }

        private void OnSerialLineErrorEvent(object sender, CommunicationErrorEvent e) {
            serialLine.Disconnect();
            eventProcessor.OnCatchException(new Exception("Устройство отключено"));
        }

        private void OnSerialLineReceiveEvent(object sender, CommunicationReceiveEvent e) {
            try {
                if (isReceiveData)
                    return;

                receiveData = e.Buffer;
                isReceiveData = true;
            } catch (Exception ex) {
                isReceiveData = false;
                eventProcessor.OnCatchException(ex);
            }
        }

	
	void OnEnable()
	{
		if(UnityPharusManager.Instance != null)
		{
			if(UnityPharusManager.Instance.EventProcessor == null)
			{
				UnityPharusManager.Instance.OnTrackingInitialized += SubscribeTrackingEvents;
			}
			else
			{
				SubscribeTrackingEvents(this, null);
			}
		}
	}
	
	void OnDisable()
	{
		if(UnityPharusManager.Instance != null)
		{
			UnityPharusManager.Instance.EventProcessor.TrackAdded -= OnTrackAdded;
			UnityPharusManager.Instance.EventProcessor.TrackUpdated -= OnTrackUpdated;
			UnityPharusManager.Instance.EventProcessor.TrackRemoved -= OnTrackRemoved;
			UnityPharusManager.Instance.OnTrackingInitialized -= SubscribeTrackingEvents;
		}
	}

	#region private methods
	private void SubscribeTrackingEvents (object theSender, System.EventArgs e)
	{
		UnityPharusManager.Instance.EventProcessor.TrackAdded += OnTrackAdded;
		UnityPharusManager.Instance.EventProcessor.TrackUpdated += OnTrackUpdated;
		UnityPharusManager.Instance.EventProcessor.TrackRemoved += OnTrackRemoved;
	}

Azure.Messaging.EventHubs.Primitives.EventProcessor<TPartition> : Object

Methods :

public String get_FullyQualifiedNamespace()
public String get_EventHubName()
public String get_ConsumerGroup()
public String get_Identifier()
public Boolean get_IsRunning()
public Task StartProcessingAsync(CancellationToken cancellationToken = null)
public Void StartProcessing(CancellationToken cancellationToken = null)
public Task StopProcessingAsync(CancellationToken cancellationToken = null)
public Void StopProcessing(CancellationToken cancellationToken = null)
public Boolean Equals(Object obj = )
public Int32 GetHashCode()
public String ToString()
public Type GetType()