Talifun.Commander.Command.CommanderManager.RaiseOnCommanderStartedEvent C# (CSharp) Méthode

RaiseOnCommanderStartedEvent() private méthode

Will raise the event on the current thread synchronously. i.e. it will wait until all event handlers have processed the event.
private RaiseOnCommanderStartedEvent ( CommanderStartedEventArgs e ) : void
e CommanderStartedEventArgs The state to be passed to the event.
Résultat void
		private void RaiseOnCommanderStartedEvent(CommanderStartedEventArgs e)
		{
			// Make a temporary copy of the event to avoid possibility of
			// a race condition if the last subscriber unsubscribes
			// immediately after the null check and before the event is raised.

			CommanderStartedEventHandler eventHandler;

			if (!Monitor.TryEnter(_commanderStartedEventLock, _lockTimeout))
			{
				throw new ApplicationException("Timeout waiting for lock - RaiseOnCommanderStartedEvent");
			}
			try
			{
				eventHandler = _commanderStartedEvent;
			}
			finally
			{
				Monitor.Exit(_commanderStartedEventLock);
			}

			OnCommanderStartedEvent(e);

			if (eventHandler != null)
			{
				eventHandler(this, e);
			}
		}
		#endregion