private void button_Click(object sender, RoutedEventArgs e) { State = Pinger.ConnectionStates.Unkn; backgroundWorker.RunWorkerAsync(new Pinger(textBox.Text)); }
void backgroundWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { if (e.UserState is IPStatus) State = (((IPStatus)e.UserState == IPStatus.Success) ? Pinger.ConnectionStates.Succ : Pinger.ConnectionStates.Fail); }