internal void SaveSurgeFile() { StringBuilder sb = new StringBuilder(); // save the history first... // foreach surge if (this.Surges != null) { for (int i = 0; i < this.Surges.Count; i++) { SurgeItem s = Surges[i]; if (i > 0) { // create a newline in the file for each surge sb.Append(Environment.NewLine); } // get string representation of this item s.Save(sb); } } // write to filee string docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); string path = Path.Combine(docs, FILENAME_HISTORY); System.IO.File.WriteAllText(path, sb.ToString()); }
partial void btnStart_Click(UIButton sender) { // setup the new current surge object model SurgeItem si = new SurgeItem(); // and set the start time si.start = DateTime.Now; // add to our collection Surges.Add(si); // and show current surge on screen StartDisplayingCurrentSurge(); }