private void loadAll() { t1 = 0.0; t2 = 0.0; AppSettings dat = new AppSettings(); dat.loadAttendance(subnum); Marks_Data m = new Marks_Data(); m.Subject = "Subject Code"; m.Slot = dat.getSubjectCode(); details.Items.Add(m); m = new Marks_Data(); m.Subject = "Type"; m.Slot = dat.getType(); details.Items.Add(m); m = new Marks_Data(); m.Subject = "Slot"; m.Slot = dat.getSlot(); details.Items.Add(m); m = new Marks_Data(); m.Subject = "Attended"; m.Slot = Convert.ToString(dat.getAttended()); details.Items.Add(m); m = new Marks_Data(); m.Subject = "Conducted"; m.Slot = Convert.ToString(dat.getConducted()); details.Items.Add(m); m = new Marks_Data(); m.Subject = "Percentage"; m.Slot = Convert.ToString(dat.getPercentage()); details.Items.Add(m); List<String> lst = new List<String>(); lst = dat.getDetails(); int i = lst.Count-1; while (i >= 0) { m = new Marks_Data(); m.Subject = lst[i-1]; m.Slot = lst[i]; moreDetais.Items.Add(m); i -= 2; } controller.Title = dat.getSubjectName(); attended = Convert.ToDouble(dat.getAttended()); conducted = Convert.ToDouble(dat.getConducted()); lbl_percent.Text = Convert.ToString(Math.Round((attended / conducted) * 100,1)) + "%"; }
private void reloadData() { try { this.Items.Clear(); AppSettings dat = new AppSettings(); string st_num; dat.TryGetSetting<string>("NUMBEROFSUBJECTS", out st_num); Debug.WriteLine(st_num); for (int i = 0; i <= Convert.ToInt32(st_num); i++) { dat.loadAttendance(i); this.Items.Add(new ItemViewModel() { LineOne = dat.getSubjectName(), LineTwo = dat.getSlot(), LineThree = dat.getPercentage() }); } var currentPage = ((App)Application.Current).RootFrame.Content as Microsoft.Phone.Controls.PhoneApplicationPage; MainPage m = (MainPage)currentPage; m.hidePrg(); m.Controller.Visibility = Visibility.Visible; m.textBlock2.Visibility = Visibility.Collapsed; m.refresh.Visibility = Visibility.Visible; loadedit = true; } catch (Exception ex) { MessageBox.Show("Error occured while loading attendance"); } }