public void Add(CatchInfo ci) { if (ci != null) { catchHistory.Add(ci); } }
private void fischer_FishCaught(object sender, FishCaughtEventArgs e) { CatchInfo ci = new CatchInfo(); ci.ID = e.ID; ci.Name = e.Name; ci.TimeStamp = DateTime.Now; try { catchHistory.Add(ci); } catch (Exception ex) { ErrorLog.OnError(ex); } string[] items = new string[3]; items[0] = e.ID.ToString("X"); items[1] = e.Name; items[2] = ci.TimeStamp.ToString(); try { Invoke(new MethodInvoker(delegate { lvCatchHistory.Items.Add(new ListViewItem(items)); })); } catch (Exception ex) { ErrorLog.OnError(ex); } try { Invoke(new MethodInvoker(delegate { lvCatchHistory.Items[lvCatchHistory.Items.Count - 1].EnsureVisible(); })); } catch (Exception ex) { ErrorLog.OnError(ex); } try { catchHistory.Save(string.Format("{0}/history/{1}_chistory.dat", Application.StartupPath, ffxi.Player.Name)); } catch (Exception ex) { ErrorLog.OnError(ex); } ++fishCountToday; }