Esempio n. 1
0
 //private void PingOnPingException(object sender, PingExceptionEventArgs pingExceptionEventArgs)
 //{
 //    Dispatcher.Invoke(() =>
 //    {
 //        var sb = new StringBuilder();
 //        var ex = pingExceptionEventArgs.Exception;
 //        while (ex != null)
 //        {
 //            sb.AppendLine(ex.Message);
 //            ex = ex.InnerException;
 //        }
 //        if (sb.Length == 0)
 //        {
 //            sb.AppendLine("Unknown error occurred.");
 //        }
 //        sb.AppendLine("Would you like to retry ?");
 //        if (MessageBox.Show(sb.ToString(), "Ping failed", MessageBoxButton.YesNo, MessageBoxImage.Warning) ==
 //            MessageBoxResult.No)
 //        {
 //            pingExceptionEventArgs.Cancel = true;
 //        }
 //    });
 //    if (pingExceptionEventArgs.Cancel)
 //    {
 //        Dispatcher.BeginInvoke(new Action(() =>
 //        {
 //            if (_ds.Collection.Count > 0)
 //            {
 //                BtnPause_OnClick(null, null);
 //            }
 //            else
 //            {
 //                BtnStop_OnClick(null,null);
 //            }
 //        }));
 //    }
 //}
 private void PingOnPingTick(object sender, PingTickEventArgs pingTickEventArgs)
 {
     Debug.Assert(_ds != null);
     _ds.AppendAsync(Dispatcher, pingTickEventArgs.Result);
 }
Esempio n. 2
0
 protected virtual void OnPintTick(PingTickEventArgs e)
 {
     EventHandler<PingTickEventArgs> handler = PingTick;
     if (handler != null) handler(this, e);
 }