/// <summary>
        /// Registers the specified rollbar event.
        /// </summary>
        /// <param name="rollbarEvent">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
        private void Register(RollbarEventArgs rollbarEvent)
        {
            if (rollbarEvent == null)
            {
                return;
            }

            var eventType = rollbarEvent.GetType();

            if (this._rollbarEventsByType.TryGetValue(eventType, out var rollbarEvents))
            {
                rollbarEvents.Add(rollbarEvent);
            }
            else
            {
                this._rollbarEventsByType.Add(
                    eventType,
                    new List <RollbarEventArgs>(new[] { rollbarEvent })
                    );
            }
        }
Exemple #2
0
        /// <summary>
        /// Called when rollbar internal event is detected.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RollbarEventArgs"/> instance containing the event data.</param>
        private static void OnRollbarInternalEvent(object sender, RollbarEventArgs e)
        {
            //Console.WriteLine(e.TraceAsString());

            switch (e)
            {
            case InternalErrorEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case RollbarApiErrorEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case CommunicationErrorEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case TransmissionOmittedEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case PayloadDropEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            case CommunicationEventArgs rollbarEvent:
                // handle this specific type of Rollbar event...
                break;

            default:
                // handle this specific type of Rollbar event...
                break;
            }

            _eventCounters[e.GetType().Name].Add(e);
        }