static public void lvPings_Renew(ListViewItem lvItem, xIP IP, xPing Ping)//Ok { if (lvItem == null || Ping == null) { return; } lvItem.SubItems[0].Text = Ping.SendTime.ToString(Options.TIME_FORMAT); lvItem.SubItems[2].Text = ""; if (Ping.State == PingStates.Send) { lvItem.SubItems[1].Text = Options.LangCur.lIPPingSend; lvItem.ImageIndex = 0; } else if (Ping.State == PingStates.Cancelled) { lvItem.SubItems[1].Text = Options.LangCur.lIPPingCancelled; lvItem.ImageIndex = 5; } else if (Ping.Error != "") { lvItem.SubItems[1].Text = Ping.Error; lvItem.ImageIndex = 5; } else { lvItem.SubItems[1].Text = Ping.Replayer; lvItem.SubItems[2].Text = Ping.TripTime.ToString(); if (Ping.TripTime < IP.TimeOutGreen) { lvItem.ImageIndex = 1; } else if (Ping.TripTime < IP.TimeOutGreen + IP.TimeOutYellow) { lvItem.ImageIndex = 2; } else if (Ping.TripTime < IP.TimeOutGreen + IP.TimeOutYellow + IP.TimeOutRed) { lvItem.ImageIndex = 3; } else { lvItem.ImageIndex = 4; } } }
static public void lvPings_Add(ListView lvPings, xIP IP, xPing Ping)//Ok { if (lvPings == null || Ping == null) { return; } var ping_item = lvPings.Items.Insert(0, ""); ping_item.SubItems.Add(""); ping_item.SubItems.Add(""); ping_item.SubItems.Add(""); if (IP.PingsCount < lvPings.Items.Count) { lvPings.Items.RemoveAt(IP.PingsCount); } lvPings_Renew(ping_item, IP, Ping); ping_item.Tag = Ping; }