本文整理汇总了C#中IEventTopicInfo类的典型用法代码示例。如果您正苦于以下问题:C# IEventTopicInfo类的具体用法?C# IEventTopicInfo怎么用?C# IEventTopicInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEventTopicInfo类属于命名空间,在下文中一共展示了IEventTopicInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FiredEvent
/// <summary>
/// Called when the event was fired (processing completed).
/// </summary>
/// <param name="eventTopic">The event topic.</param>
/// <param name="publication">The publication.</param>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
public override void FiredEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e)
{
INamedItem namedItem = publication.Publisher as INamedItem;
if (namedItem != null)
{
this.log.DebugFormat(
CultureInfo.InvariantCulture,
"Fired event '{0}'. Invoked by publisher '{1}' with name '{2}' with sender '{3}' and EventArgs '{4}'.",
eventTopic.Uri,
publication.Publisher,
namedItem.EventBrokerItemName,
sender,
e);
}
else
{
this.log.DebugFormat(
CultureInfo.InvariantCulture,
"Fired event '{0}'. Invoked by publisher '{1}' with sender '{2}' and EventArgs '{3}'.",
eventTopic.Uri,
publication.Publisher,
sender,
e);
}
}
示例2: MissingMappingContext
/// <summary>
/// Initializes a new instance of the <see cref="MissingMappingContext"/> class.
/// </summary>
/// <param name="eventTopic">The source event topic.</param>
/// <param name="destinationTopic">The destination topic URI.</param>
/// <param name="publication">The publication which triggered the event.</param>
/// <param name="sender">The sender of the event.</param>
/// <param name="eventArgs">The <see cref="System.EventArgs"/> instance containing the event data.</param>
/// <param name="exception">The exception which contains information why the mapping was not possible.</param>
public MissingMappingContext(IEventTopicInfo eventTopic, string destinationTopic, IPublication publication, object sender, EventArgs eventArgs, Exception exception)
{
this.Exception = exception;
this.EventArgs = eventArgs;
this.Sender = sender;
this.Publication = publication;
this.DestinationTopic = destinationTopic;
this.EventTopic = eventTopic;
}
示例3: CallWithoutThreadSwitch
private void CallWithoutThreadSwitch(IEventTopicInfo eventTopic, object subscriber, IDelegateWrapper delegateWrapper, object sender, EventArgs e)
{
try
{
delegateWrapper.Invoke(subscriber, sender, e);
}
catch (TargetInvocationException exception)
{
this.HandleSubscriberMethodException(exception, eventTopic);
}
}
示例4: Handle
public override void Handle(IEventTopicInfo eventTopic, object subscriber, object sender, EventArgs e, IDelegateWrapper delegateWrapper)
{
if (this.RunningOnUserInterfaceThread())
{
this.CallWithoutThreadSwitch(eventTopic, subscriber, delegateWrapper, sender, e);
}
else
{
this.CallWithThreadSwitch(eventTopic, subscriber, delegateWrapper, sender, e);
}
}
示例5: Handle
public void Handle(IEventTopicInfo eventTopic, object subscriber, object sender, EventArgs e, IDelegateWrapper delegateWrapper)
{
IEventScopeRegistry registry = this.scopeHolder.Current;
if (registry != null)
{
registry.Register(() => this.handler.Handle(eventTopic, subscriber, sender, e, delegateWrapper));
}
else
{
this.handler.Handle(eventTopic, subscriber, sender, e, delegateWrapper);
}
}
示例6: Handle
public override void Handle(IEventTopicInfo eventTopic, object subscriber, object sender, EventArgs e, IDelegateWrapper delegateWrapper)
{
Ensure.ArgumentNotNull(delegateWrapper, "delegateWrapper");
try
{
delegateWrapper.Invoke(subscriber, sender, e);
}
catch (TargetInvocationException ex)
{
this.HandleSubscriberMethodException(ex, eventTopic);
}
}
示例7: Handle
public override void Handle(IEventTopicInfo eventTopic, object subscriber, object sender, EventArgs e, IDelegateWrapper delegateWrapper)
{
this.syncContextHolder.SyncContext.Post(
delegate(object data)
{
try
{
((IDelegateWrapper)data).Invoke(subscriber, sender, e);
}
catch (TargetInvocationException exception)
{
this.HandleSubscriberMethodException(exception, eventTopic);
}
},
delegateWrapper);
}
示例8: HandleSubscriberMethodException
/// <summary>
/// Handles a subscriber method exception by passing it to all extensions and re-throwing the inner exception in case that none of the
/// extensions handled it.
/// </summary>
/// <param name="targetInvocationException">The targetInvocationException.</param>
/// <param name="eventTopic">The event topic.</param>
protected void HandleSubscriberMethodException(TargetInvocationException targetInvocationException, IEventTopicInfo eventTopic)
{
Ensure.ArgumentNotNull(targetInvocationException, "targetInvocationException");
var innerException = targetInvocationException.InnerException;
innerException.PreserveStackTrace();
var context = new ExceptionHandlingContext();
this.ExtensionHost.ForEach(extension => extension.SubscriberExceptionOccurred(eventTopic, innerException, context));
if (!context.Handled)
{
throw innerException;
}
}
示例9: Handle
public override void Handle(IEventTopicInfo eventTopic, object subscriber, object sender, EventArgs e, IDelegateWrapper delegateWrapper)
{
ThreadPool.QueueUserWorkItem(
delegate(object state)
{
try
{
var args = (CallInBackgroundArguments)state;
args.DelegateWrapper.Invoke(args.Subscriber, args.Sender, args.EventArgs);
}
catch (TargetInvocationException exception)
{
this.HandleSubscriberMethodException(exception, eventTopic);
}
},
new CallInBackgroundArguments(subscriber, sender, e, delegateWrapper));
}
示例10: AddedPublication
/// <summary>
/// Called after a publication was added to an event topic.
/// </summary>
/// <param name="eventTopic">The event topic.</param>
/// <param name="publication">The publication.</param>
public override void AddedPublication(IEventTopicInfo eventTopic, IPublication publication)
{
using (TextWriter writer = new StringWriter(CultureInfo.InvariantCulture))
{
foreach (IPublicationMatcher publicationMatcher in publication.PublicationMatchers)
{
publicationMatcher.DescribeTo(writer);
writer.Write(", ");
}
Console.WriteLine(
"Added publication '{0}.{1}' to topic '{2}' with matchers '{3}'.",
publication.Publisher != null ? publication.Publisher.GetType().FullName : "-",
publication.EventName,
eventTopic.Uri,
writer);
}
}
示例11: AddedSubscription
/// <summary>
/// Called after a subscription was added to an event topic.
/// </summary>
/// <param name="eventTopic">The event topic.</param>
/// <param name="subscription">The subscription.</param>
public override void AddedSubscription(IEventTopicInfo eventTopic, ISubscription subscription)
{
using (TextWriter writer = new StringWriter(CultureInfo.InvariantCulture))
{
foreach (ISubscriptionMatcher subscriptionMatcher in subscription.SubscriptionMatchers)
{
subscriptionMatcher.DescribeTo(writer);
writer.Write(", ");
}
Console.WriteLine(
"Added subscription '{0}.{1}' to topic '{2}' with matchers '{3}'.",
subscription.Subscriber != null ? subscription.Subscriber.GetType().FullName : "-",
subscription.HandlerMethodName,
eventTopic.Uri,
writer);
}
}
示例12: FiredEvent
/// <summary>
/// Called when the event was fired (processing completed).
/// </summary>
/// <param name="eventTopic">The event topic.</param>
/// <param name="publication">The publication.</param>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
public override void FiredEvent(IEventTopicInfo eventTopic, IPublication publication, object sender, EventArgs e)
{
INamedItem namedItem = publication.Publisher as INamedItem;
if (namedItem != null)
{
Debug.WriteLine(
"Fired event '{0}'. Invoked by publisher '{1}' with name '{2}' with sender '{3}' and EventArgs '{4}'.",
eventTopic.Uri,
publication.Publisher,
namedItem.EventBrokerItemName,
sender,
e);
}
else
{
Debug.WriteLine(
"Fired event '{0}'. Invoked by publisher '{1}' with sender '{2}' and EventArgs '{3}'.",
eventTopic.Uri,
publication.Publisher,
sender,
e);
}
}
示例13: RelayedEvent
/// <summary>
/// Called after the event was relayed from the publication to the subscribers.
/// </summary>
/// <param name="eventTopic">The event topic.</param>
/// <param name="publication">The publication.</param>
/// <param name="subscription">The subscription.</param>
/// <param name="handler">The handler.</param>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
public override void RelayedEvent(IEventTopicInfo eventTopic, IPublication publication, ISubscription subscription, IHandler handler, object sender, EventArgs e)
{
this.log.DebugFormat(
"Relayed event '{6}' from publisher '{0}' [{1}] to subscriber '{2}' [{3}] with EventArgs '{4}' with handler '{5}'.",
publication.Publisher,
publication.Publisher is INamedItem ? ((INamedItem)publication.Publisher).EventBrokerItemName : string.Empty,
subscription.Subscriber,
subscription.Subscriber is INamedItem ? ((INamedItem)subscription.Subscriber).EventBrokerItemName : string.Empty,
e,
handler,
eventTopic.Uri);
}
示例14: RemovedSubscription
/// <summary>
/// Called after a subscription was removed from an event topic.
/// </summary>
/// <param name="eventTopic">The event topic.</param>
/// <param name="subscription">The subscription.</param>
public override void RemovedSubscription(IEventTopicInfo eventTopic, ISubscription subscription)
{
this.log.DebugFormat(
"Removed subscription '{0}.{1}' from topic '{2}'.",
subscription.Subscriber != null ? subscription.Subscriber.GetType().FullName : "-",
subscription.HandlerMethodName,
eventTopic.Uri);
}
示例15: RemovedPublication
/// <summary>
/// Called after a publication was removed from an event topic.
/// </summary>
/// <param name="eventTopic">The event topic.</param>
/// <param name="publication">The publication.</param>
public override void RemovedPublication(IEventTopicInfo eventTopic, IPublication publication)
{
this.log.DebugFormat(
"Removed publication '{0}.{1}' from topic '{2}'.",
publication.Publisher != null ? publication.Publisher.GetType().FullName : "-",
publication.EventName,
eventTopic.Uri);
}