public static void updatePing() { while (true) { using (Ping p = new Ping()) { try { var ping = PingModule.GetPing(PingModule.ip); if (nIcon.Icon != null) { nIcon.Icon.Dispose(); } Icon icon = CreateTextIcon(ping.ToString()); nIcon.Icon = icon; DestroyIcon(icon.Handle); } catch (Exception e) { Debug.WriteLine(e); } } Thread.Sleep(1000); } }
private void Ping_Click(object sender, RoutedEventArgs e) { long ping = PingModule.GetPing("1.1.1.1"); dbConnector.InsertPing(ping); }