private void RaisePricesFromCsv() { // read csv file line-by-line. using (var reader = new StreamReader(fileName)) { string s; reader.ReadLine(); while ((s = reader.ReadLine()) != null) { var data = s.Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); if (data.Length < 5) { continue; } var p = new PriceItem { Date = DateTime.Parse(data[0]), Last = decimal.Parse(data[1]), Bid = decimal.Parse(data[3]), Offer = decimal.Parse(data[4]), }; RaiseNewPrice(p); } } }
public void AddSeedPrice(DateTime date, decimal last, decimal bid, decimal offer) { var item = new PriceItem { Date = date, Last = last, Bid = bid, Offer = offer }; prices.Add(item); }
protected void RaiseNewPrice(PriceItem item) { NewPrice?.Invoke(this, new NewPriceEventArgs(item)); }
public NewPriceEventArgs(PriceItem item) { NewPrice = item; }