private void PingIP(GMUListtoPing GmuDetails) { try { Ping CheckConnectivity = new Ping(); PingReply reply = CheckConnectivity.Send(GmuDetails.IPAddress, _PingTimeoutMilliseconds); GmuDetails.Status = reply.Status.ToString(); GmuDetails.IsEnabled = true; } catch (Exception Ex) { ExceptionManager.Publish(Ex); GmuDetails.Status = "Fail"; GmuDetails.IsEnabled = true; } }
private void btnPing_Click(object sender, RoutedEventArgs e) { try { if (_Isprocessing == false) { _Isprocessing = true; Button btn = sender as Button; btn.IsEnabled = false; GMUListtoPing GMU = btn.DataContext as GMUListtoPing; GMU.Status = "Processing"; GMU.IsEnabled = false; Action <GMUListtoPing> PingMachine = new Action <GMUListtoPing>(PingIP); PingMachine.BeginInvoke(GMU, null, null); _Isprocessing = false; } } catch (Exception Ex) { _Isprocessing = false; ExceptionManager.Publish(Ex); } }