/// <summary> /// Unregisters for notification of the <see>RealmsRetrieved</see> event at the specified priority. /// </summary> /// <remarks> /// <para>The event system in the JinxBot API supports normal event registration and prioritized event registration. You can use /// normal syntax to register for events at <see cref="Priority">Normal priority</see>, so no special registration is needed; this is /// accessed through normal event handling syntax (the += syntax in C#, or the <see langword="Handles" lang="VB" /> in Visual Basic.</para> /// <para>Events in the JinxBot API are never guaranteed to be executed on the UI thread. Events that affect the user interface should /// be marshaled back to the UI thread by the event handling code. Generally, high-priority event handlers are /// raised on the thread that is parsing data from Battle.net, and lower-priority event handler are executed from the thread pool.</para> /// <para>JinxBot guarantees that all event handlers will be fired regardless of exceptions raised in previous event handlers. However, /// if a plugin repeatedly raises an exception, it may be forcefully unregistered from events.</para> /// <para>To be well-behaved within JinxBot, plugins should always unregister themselves when they are being unloaded or when they /// otherwise need to do so. Plugins may opt-in to a Reflection-based event handling registration system which uses attributes to /// mark methods that should be used as event handlers.</para> /// </remarks> /// <param name="p">The priority from which to unregister.</param> /// <param name="callback">The event handler that should be unregistered for this event.</param> /// <seealso cref="RealmsRetrieved" /> /// <seealso cref="RegisterRealmsRetrievedNotification" /> public void UnregisterRealmsRetrievedNotification(Priority p, AvailableRealmsEventHandler callback) { if (__RealmsRetrieved.ContainsKey(p)) { __RealmsRetrieved[p].Remove(callback); } }
/// <summary> /// Registers for notification of the <see>RealmsRetrieved</see> event at the specified priority. /// </summary> /// <remarks> /// <para>The event system in the JinxBot API supports normal event registration and prioritized event registration. You can use /// normal syntax to register for events at <see cref="Priority">Normal priority</see>, so no special registration is needed; this is /// accessed through normal event handling syntax (the += syntax in C#, or the <see langword="Handles" lang="VB" /> in Visual Basic.</para> /// <para>Events in the JinxBot API are never guaranteed to be executed on the UI thread. Events that affect the user interface should /// be marshaled back to the UI thread by the event handling code. Generally, high-priority event handlers are /// raised on the thread that is parsing data from Battle.net, and lower-priority event handler are executed from the thread pool.</para> /// <para>JinxBot guarantees that all event handlers will be fired regardless of exceptions raised in previous event handlers. However, /// if a plugin repeatedly raises an exception, it may be forcefully unregistered from events.</para> /// <para>To be well-behaved within JinxBot, plugins should always unregister themselves when they are being unloaded or when they /// otherwise need to do so. Plugins may opt-in to a Reflection-based event handling registration system which uses attributes to /// mark methods that should be used as event handlers.</para> /// </remarks> /// <param name="p">The priority at which to register.</param> /// <param name="callback">The event handler that should be registered for this event.</param> /// <seealso cref="RealmsRetrieved" /> /// <seealso cref="UnregisterRealmsRetrievedNotification" /> public void RegisterRealmsRetrievedNotification(Priority p, AvailableRealmsEventHandler callback) { lock (__RealmsRetrieved) { if (!__RealmsRetrieved.ContainsKey(p)) { __RealmsRetrieved.Add(p, new List <AvailableRealmsEventHandler>()); } } __RealmsRetrieved[p].Add(callback); }
/// <summary> /// Registers for notification of the <see>RealmsRetrieved</see> event at the specified priority. /// </summary> /// <remarks> /// <para>The event system in the JinxBot API supports normal event registration and prioritized event registration. You can use /// normal syntax to register for events at <see cref="Priority">Normal priority</see>, so no special registration is needed; this is /// accessed through normal event handling syntax (the += syntax in C#, or the <see langword="Handles" lang="VB" /> in Visual Basic.</para> /// <para>Events in the JinxBot API are never guaranteed to be executed on the UI thread. Events that affect the user interface should /// be marshaled back to the UI thread by the event handling code. Generally, high-priority event handlers are /// raised on the thread that is parsing data from Battle.net, and lower-priority event handler are executed from the thread pool.</para> /// <para>JinxBot guarantees that all event handlers will be fired regardless of exceptions raised in previous event handlers. However, /// if a plugin repeatedly raises an exception, it may be forcefully unregistered from events.</para> /// <para>To be well-behaved within JinxBot, plugins should always unregister themselves when they are being unloaded or when they /// otherwise need to do so. Plugins may opt-in to a Reflection-based event handling registration system which uses attributes to /// mark methods that should be used as event handlers.</para> /// </remarks> /// <param name="p">The priority at which to register.</param> /// <param name="callback">The event handler that should be registered for this event.</param> /// <seealso cref="RealmsRetrieved" /> /// <seealso cref="UnregisterRealmsRetrievedNotification" /> public void RegisterRealmsRetrievedNotification(Priority p, AvailableRealmsEventHandler callback) { lock (__RealmsRetrieved) { if (!__RealmsRetrieved.ContainsKey(p)) { __RealmsRetrieved.Add(p, new List<AvailableRealmsEventHandler>()); } } __RealmsRetrieved[p].Add(callback); }