コード例 #1
0
        /// <summary>
        ///     Enqueue a signal for upload
        /// </summary>
        /// <param name="signal">signal to serialize as JSON and upload.</param>
        /// <remarks>
        ///     <para>
        ///         The actual upload will be done in the background.
        ///     </para>
        ///     <para>
        ///         Will do nothing if <see cref="Configure" /> have not been used.
        ///     </para>
        /// </remarks>
        public static void Send(SignalDTO signal)
        {
            if (signal == null)
            {
                throw new ArgumentNullException("signal");
            }
            if (_uri == null)
            {
                return;
            }

            _instance._signalsToSend.Enqueue(signal);
        }
コード例 #2
0
        /// <summary>
        ///     Will subscribe on the <see cref="Signal.SignalRaised" /> and <see cref="Signal.SignalSuppressed" /> to be able to
        ///     upload all signals.
        /// </summary>
        /// <exception cref="InvalidOperationException">You must Configure() first.</exception>
        public static void UploadAllSignals()
        {
            if (_appName == null)
            {
                throw new InvalidOperationException("You must Configure() first.");
            }

            Signal.SignalRaised += (sender, args) =>
            {
                string ex = null;
                if (args.Exception != null)
                {
                    ex = args.Exception.ToString();
                }
                var dto = new SignalDTO(_appName, (Signal)sender)
                {
                    CallingMethod = args.CallingMethod,
                    Exception     = ex,
                    Reason        = args.Reason
                };
                Send(dto);
            };
            Signal.SignalSuppressed += (sender, args) => Send((Signal)sender);
        }
コード例 #3
0
        /// <summary>
        ///     Enqueue a signal for upload
        /// </summary>
        /// <param name="signal">signal to serialize as JSON and upload.</param>
        /// <remarks>
        ///     <para>
        ///         The actual upload will be done in the background.
        ///     </para>
        ///     <para>
        ///         Will do nothing if <see cref="Configure" /> have not been used.
        ///     </para>
        /// </remarks>
        public static void Send(SignalDTO signal)
        {
            if (signal == null) throw new ArgumentNullException("signal");
            if (_uri == null)
                return;

            _instance._signalsToSend.Enqueue(signal);
        }
コード例 #4
0
        /// <summary>
        ///     Will subscribe on the <see cref="Signal.SignalRaised" /> and <see cref="Signal.SignalSuppressed" /> to be able to
        ///     upload all signals.
        /// </summary>
        /// <exception cref="InvalidOperationException">You must Configure() first.</exception>
        public static void UploadAllSignals()
        {
            if (_appName == null)
                throw new InvalidOperationException("You must Configure() first.");

            Signal.SignalRaised += (sender, args) =>
            {
                string ex = null;
                if (args.Exception != null)
                    ex = args.Exception.ToString();
                var dto = new SignalDTO(_appName, (Signal) sender)
                {
                    CallingMethod = args.CallingMethod,
                    Exception = ex,
                    Reason = args.Reason
                };
                Send(dto);
            };
            Signal.SignalSuppressed += (sender, args) => Send((Signal) sender);
        }