예제 #1
0
 public void InvokeAllEvents()
 {
     PublicEvent?.Invoke();
     PrivateEvent?.Invoke();
     InternalEvent?.Invoke();
     ProtectedEvent?.Invoke();
     ProtectedInternalEvent?.Invoke();
 }
        protected MessageFinalResponse OnAppDequeue(string message, IConsumer sender, ulong deliveryTag)
        {
#if DEBUG
            Debug.WriteLine(message);
#endif
            // load the message
            try
            {
                var jsonMsg   = (JObject)JToken.Parse(message);
                var eventName = jsonMsg.SelectToken("type").Value <string>();

                var type = _client.Asm.GetType("AsterNET.ARI.Models." + eventName + "Event");

                // Get the instance of BrokeredSession for this dialogue and pass as sender
                // to InternalEvent

                if (type != null)
                {
                    InternalEvent.Invoke(this,
                                         (Event)JsonConvert.DeserializeObject(jsonMsg.SelectToken("ari_body").Value <string>(), type));
                }
                else
                {
                    InternalEvent.Invoke(this,
                                         (Event)JsonConvert.DeserializeObject(jsonMsg.SelectToken("ari_body").Value <string>()));
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Debug.WriteLine("Raise Event Failed: ", ex.Message);
#endif
            }

            return(MessageFinalResponse.Accept);
        }
예제 #3
0
 /// <summary>
 /// Handles the <see cref="E:RollbarEvent" /> event.
 /// </summary>
 /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
 internal virtual void OnRollbarEvent(RollbarEventArgs e)
 {
     InternalEvent?.Invoke(this, e);
 }