/// <summary>Retrieves the remote IPv4 address for this system from icanhazip.com.</summary> public void GetRemoteIP() { // Reset elapsed seconds p_ElapsedSeconds = 0; if (Global.IsOnline) { // Create a new WebClient object and download the string webClient.DownloadStringAsync(new Uri("http://icanhazip.com/")); } else { // Local variables StatusCode newStatus = StatusCode.Offline; int imageIndex = 2; string ip = "-"; string status = "-"; // Set status to Offline StatusText = "Unable to log connection: " + Global.ConvertTime(DateTime.Now); if (p_CurrentIP != ip) { status = "IP Changed"; imageIndex = 1; p_CurrentIP = ip; } if (!p_CurrentStatus.Equals(newStatus)) { status = "Offline"; imageIndex = 1; p_CurrentStatus = newStatus; } // Create a new ListViewItem object ListViewItem item = new ListViewItem(DateTime.Now, 0); item.SubItems.Add(Global.ConvertBytes(0) + "/s"); item.SubItems.Add(p_CurrentIP); item.SubItems.Add("Offline"); item.SubItems.Add(status); item.ImageIndex = imageIndex; // Add the ListViewItem to the log AddItem(item); } }