コード例 #1
0
 private void ShowIP()
 {
     if (pingVis.CurrentResult != null && pingVis.CurrentResult.Address != null)
     {
         string address = pingVis.CurrentResult.Address.ToString();
         var    blah    = OtherFunctions.Message(address + " - " + NetworkInfo.LocationOfIP(address) + "\r\n" + "\r\n" + "Press 'Yes' to copy to clipboard.", MessageBoxButtons.YesNo, MessageBoxIcon.Information, "IP Address", hostForm);
         if (blah == DialogResult.Yes)
         {
             Clipboard.SetText(address);
         }
     }
 }
コード例 #2
0
        public static void ShowPingHistory(ExtendedForm parentForm, Device device)
        {
            string query = "SELECT timestamp, hostname, ip FROM device_ping_history WHERE device_guid = '" + device.Guid + "' ORDER BY timestamp DESC";

            using (var results = DBFactory.GetDatabase().DataTableFromQueryString(query))
            {
                if (results.Rows.Count > 0)
                {
                    results.Columns.Add("location");

                    foreach (DataRow row in results.Rows)
                    {
                        row["location"] = NetworkInfo.LocationOfIP(row["ip"].ToString());
                    }

                    var newGrid = new GridForm(parentForm, "Ping History - " + device.HostName);
                    newGrid.AddGrid("pingGrid", "Ping History", results);
                    newGrid.Show();
                }
            }
        }