/// <summary>
        ///     Initializes a new instance of the <see cref="UploadToOneTrueError" /> class.
        /// </summary>
        /// <param name="oneTrueHost">
        ///     Uri to the root of the OneTrueError web. Example.
        ///     <code>http://yourWebServer/OneTrueError/</code>
        /// </param>
        /// <param name="apiKey">The API key.</param>
        /// <param name="sharedSecret">The shared secret.</param>
        /// <exception cref="System.ArgumentNullException">apiKey</exception>
        public UploadToOneTrueError(Uri oneTrueHost, string apiKey, string sharedSecret)
        {
            if (string.IsNullOrEmpty(apiKey))
            {
                throw new ArgumentNullException("apiKey");
            }
            if (string.IsNullOrEmpty(sharedSecret))
            {
                throw new ArgumentNullException("sharedSecret");
            }

            if (oneTrueHost.AbsolutePath.Contains("/receiver/"))
            {
                throw new ArgumentException(
                          "The OneTrueError URI should not contain the reporting area '/receiver/', but should point at the site root.");
            }
            if (!oneTrueHost.AbsolutePath.EndsWith("/"))
            {
                oneTrueHost = new Uri(oneTrueHost + "/");
            }

            _reportUri     = new Uri(oneTrueHost, "receiver/report/" + apiKey + "/");
            _feedbackUri   = new Uri(oneTrueHost, "receiver/report/" + apiKey + "/feedback/");
            _apiKey        = apiKey;
            _sharedSecret  = sharedSecret;
            _feedbackQueue = new UploadQueue <FeedbackDTO>(TryUploadFeedbackNow);
            _feedbackQueue.UploadFailed += OnUploadFailed;
            _reportQueue = new UploadQueue <ErrorReportDTO>(TryUploadReportNow);
            _reportQueue.UploadFailed += OnUploadFailed;
        }
 /// <summary>
 ///     Dispose pattern
 /// </summary>
 /// <param name="isDisposing">Invoked from the dispose method.</param>
 protected virtual void Dispose(bool isDisposing)
 {
     if (_reportQueue != null)
     {
         _reportQueue.Dispose();
         _reportQueue = null;
     }
 }
 /// <summary>
 ///     Creates a new instance of <see cref="UploadDispatcher" />.
 /// </summary>
 /// <param name="configuration">Used to check at runtime of queuing is enabled or not.</param>
 public UploadDispatcher(OneTrueConfiguration configuration)
 {
     _configuration = configuration;
     _reportQueue   = new UploadQueue <ErrorReportDTO>(UploadReportNow);
     _feedbackQueue = new UploadQueue <FeedbackDTO>(UploadFeedbackNow);
 }