예제 #1
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         throw null;
     }
     catch (Exception oops)
     {
         ET.Publish(oops);
     }
 }
        private void bwSendGazillion_DoWork(object sender, DoWorkEventArgs e)
        {
            _logger.Info("Sending gazillions");

            var backgroundWorker = (BackgroundWorker)sender;

            var sent = 0;

            for (var i = 1; i <= 5; i++)
            {
                if (backgroundWorker.CancellationPending)
                {
                    _logger.Info("BW canceled");
                    return;
                }
                var lastSecond = _stopWatch.Elapsed.Seconds;
                for (var j = 0; j < _maxPerSecond; j++)
                {
                    if (_stopWatch.Elapsed.Seconds > lastSecond)
                    {
                        break;
                    }
                    Exception exception = null;
                    try
                    {
                        RandomException();
                    }
                    catch (Exception oops)
                    {
                        exception = oops;
                    }
                    try
                    {
                        _logger.Info("Calling Publish method");

                        ET.Publish(exception);

                        _logger.Info("Publish");
                        backgroundWorker.ReportProgress(sent++);
                    }
                    catch (Exception oops)
                    {
                        Invoke(new MethodInvoker(() => MessageBox.Show(oops.StackTrace)));
                    }
                }
                while (lastSecond == _stopWatch.Elapsed.Seconds)
                {
                    Thread.Sleep(2);
                }
            }
        }
예제 #3
0
        private void BtnSendGazillionClick(object sender, RoutedEventArgs e)
        {
            Exception exception = null;

            try
            {
                RandomException();
            }
            catch (Exception oops)
            {
                exception = oops;
            }

            ET.Publish(exception);

            var etStats = ET.GetStats();

            textBlock1.Text = etStats.NumberOfExceptionsInQueue + " " + etStats.NumberOfExceptionsInSendQueue + " " +
                              etStats.NumberOfExceptionsSent;

            var etExceptions = ET.GetExceptions();

            ET.SendExceptions(etExceptions);
        }
 public void ProvideFault(Exception error, MessageVersion version, ref Message fault)
 {
     ET.Publish(error);
 }