Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Confusing code

$
0
0

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);

Album removedAlbum = (Album)lbxDisplay.SelectedItem;
            lbxDisplay.Items.Remove(lbxDisplay.SelectedItem);
            decimal newTotal = Convert.ToDecimal(tblkTotal.Text) - removedAlbum.Price;
            tblkTotal.Text = newTotal.ToString();

            

Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>