call.CallCategory = (CallCategory)Enum.Parse(typeof(CallCategory),callDetails[4]);
cbxCategories.ItemsSource =
Enum.GetValues(typeof(CallCategory)).Cast<CallCategory>();
calls = new ObservableCollection<Call>();
string[] listOfCalls = File.ReadAllLines("calls.txt");
string[] callDetails = new string[5];
for (int i = 0; i < listOfCalls.Length; i++)
{
Call call = new Call();
callDetails = listOfCalls[i].Split(',');
call.Date = Convert.ToDateTime(callDetails[0]);
call.CallerName = callDetails[1];
call.CallerPhone = callDetails[2];
call.CallDetails = callDetails[3];
call.CallCategory = (CallCategory)Enum.Parse(typeof(CallCategory),callDetails[4]);
calls.Add(call);
string[] allCalls = new string[calls.Count];
for (int i = 0; i < calls.Count; i++)
{
allCalls[i] = calls[i].CallDetailsToFile();
}
//save to file
File.WriteAllLines(Directory.GetCurrentDirectory() + "\\calls.txt",
allCalls);
lbxDisplay.Items.Remove(lbxDisplay.SelectedItem);
decimal newTotal = Convert.ToDecimal(tblkTotal.Text) - removedAlbum.Price;
tblkTotal.Text = newTotal.ToString();