public void SavePhonebookToFile(CallerList callerList)
        {
            var dialogResult = SaveFileDialog();

            if (dialogResult != DialogResult.OK)
            {
                return;
            }

            CreateFile(path);
            if (fileStream == null)
            {
                return;
            }

            using (StreamWriter streamWriter = new StreamWriter(fileStream))
            {
                for (int i = 0; i < callerList.Count; i++)
                {
                    Caller caller = callerList.GetAt(i);

                    streamWriter.WriteLine(caller.Record.Name + COLUMN_SEPARATOR + caller.Record.PhoneNumber);
                }
            }
        }
示例#2
0
 public Record GetRecordAt(int i)
 {
     return(callerList.GetAt(i).Record);
 }