public ListViewItem GetListItem() { bool isInList = true; if (itmSpawnTimerList == null) { itmSpawnTimerList = new ListViewItem(RegexHelper.FixMobName(LastSpawnName)); isInList = false; listNeedsUpdate = true; for (int t = 0; t < 10; t++) { itmSpawnTimerList.SubItems.Add(""); } } SpawnTimeRemaining = SecondsUntilSpawn(DateTime.Now); if (SpawnTimeRemaining < 1 || SpawnTimeRemaining > 120) { itmSpawnTimerList.ForeColor = Color.Black; } else if (SpawnTimeRemaining < 30) { itmSpawnTimerList.ForeColor = Color.Red; } else if (SpawnTimeRemaining < 60) { itmSpawnTimerList.ForeColor = Color.IndianRed; } else { itmSpawnTimerList.ForeColor = SpawnTimeRemaining < 90 ? Color.Orange : Color.Goldenrod; } if (listNeedsUpdate) { listNeedsUpdate = false; itmSpawnTimerList.SubItems[1].Text = SpawnTimeRemaining.ToString(); itmSpawnTimerList.SubItems[2].Text = SpawnTimer.ToString(); itmSpawnTimerList.SubItems[3].Text = zone; itmSpawnTimerList.SubItems[4].Text = X.ToString(); itmSpawnTimerList.SubItems[5].Text = Y.ToString(); itmSpawnTimerList.SubItems[6].Text = Z.ToString(); itmSpawnTimerList.SubItems[7].Text = SpawnCount.ToString(); itmSpawnTimerList.SubItems[8].Text = SpawnTimeStr; itmSpawnTimerList.SubItems[9].Text = KillTimeStr; itmSpawnTimerList.SubItems[10].Text = NextSpawnStr; } else { if (SpawnTimeRemaining.ToString() != itmSpawnTimerList.SubItems[1].Text) { itmSpawnTimerList.SubItems[1].Text = SpawnTimeRemaining.ToString(); } } if (!isInList) { return(itmSpawnTimerList); } else { return(null); // it already is in the list - don't add it again } }