private void svc_GetCurrentPeriodCompleted(object sender, GetCurrentPeriodCompletedEventArgs e) { Period = e.Result; if (CurrentPeriodLoadCompleted != null) { CurrentPeriodLoadCompleted(this, null); } }
void client_GetCurrentPeriodCompleted(object sender, GetCurrentPeriodCompletedEventArgs e) { Connection con = e.Result; if (con.State) { Period period = con.DataObject as Period; foreach (Lesson newLesson in period.Lessons) { string text = ""; Lesson oldLesson = currentPeriod.Lessons.SingleOrDefault(x => x.Code == newLesson.Code); bool isNew = false; if (newLesson.FirstMidterm.Mark != oldLesson.FirstMidterm.Mark && newLesson.FirstMidterm.Mark != null) { text += "1. Vize: " + newLesson.FirstMidterm.Mark + " "; isNew = true; } if (newLesson.SecondMidterm.Mark != oldLesson.SecondMidterm.Mark && newLesson.SecondMidterm.Mark != null) { text += "2. Vize: " + newLesson.SecondMidterm.Mark + " "; isNew = true; } if (newLesson.ThirdMidterm.Mark != oldLesson.ThirdMidterm.Mark && newLesson.ThirdMidterm.Mark != null) { text += "3. Vize: " + newLesson.ThirdMidterm.Mark + " "; isNew = true; } if (newLesson.Final.Mark != oldLesson.Final.Mark && newLesson.Final.Mark != null) { text += "Final: " + newLesson.Final.Mark + " "; isNew = true; } if (newLesson.Integration.Mark != oldLesson.Integration.Mark && newLesson.Integration.Mark != null) { text += "Bütünleme: " + newLesson.Integration.Mark + " "; isNew = true; } if (newLesson.Average != oldLesson.Average && newLesson.Average != null) { text += "Ortalama: " + newLesson.Average + " "; isNew = true; } if (!isNew) { text = text.Replace(newLesson.Name + " ", ""); } if (!string.IsNullOrEmpty(text)) { ShellToast Toast = new ShellToast(); Toast.Title = "Mobisis: " + newLesson.Name; Toast.Content = text; //Toast.NavigationUri = new Uri("/LessonDetailsPage.xaml?PeriodCode=" + currentPeriod.Code + "&PeriodYearCode=" + currentPeriod.YearCode + "&Code=" + newLesson.Code, UriKind.Relative); Toast.Show(); } } student.Programs[0].Periods.RemoveAt(0); student.Programs[0].Periods.Insert(0, period); StudentData.SaveMyData(student, "Student"); } NotifyComplete(); }
private void client_GetCurrentPeriodCompleted(object sender, GetCurrentPeriodCompletedEventArgs e) { if (SystemTray.ProgressIndicator != null) { SystemTray.ProgressIndicator.IsVisible = false; } Connection con = e.Result; if (con.Message != null) { MessageBox.Show(con.Message); } if (con.State) { Period period = con.DataObject as Period; string text = ""; foreach (Lesson newLesson in period.Lessons) { Lesson oldLesson = Database.Student.Programs[0].Periods.First().Lessons.SingleOrDefault(x => x.Code == newLesson.Code); bool isNew = false; text += newLesson.Name + "\n"; if (newLesson.FirstMidterm.Mark != oldLesson.FirstMidterm.Mark && newLesson.FirstMidterm.Mark != null) { text += " 1. Vize: " + newLesson.FirstMidterm.Mark + "\n"; isNew = true; } if (newLesson.SecondMidterm.Mark != oldLesson.SecondMidterm.Mark && newLesson.SecondMidterm.Mark != null) { text += " 2. Vize: " + newLesson.SecondMidterm.Mark + "\n"; isNew = true; } if (newLesson.ThirdMidterm.Mark != oldLesson.ThirdMidterm.Mark && newLesson.ThirdMidterm.Mark != null) { text += " 3. Vize: " + newLesson.ThirdMidterm.Mark + "\n"; isNew = true; } if (newLesson.Final.Mark != oldLesson.Final.Mark && newLesson.Final.Mark != null) { text += " Final: " + newLesson.Final.Mark + "\n"; isNew = true; } if (newLesson.Integration.Mark != oldLesson.Integration.Mark && newLesson.Integration.Mark != null) { text += " Bütünleme: " + newLesson.Integration.Mark + "\n"; isNew = true; } if (newLesson.Average != oldLesson.Average && newLesson.Average != null) { text += " Ortalama: " + newLesson.Average + "\n"; isNew = true; } if (!isNew) { text = text.Replace(newLesson.Name + "\n", ""); } } if (!string.IsNullOrEmpty(text)) { MessageBox.Show(text); } Database.Student.Programs[0].Periods.RemoveAt(0); Database.Student.Programs[0].Periods.Insert(0, period); Database.UpdateStudent(); Container.DataContext = period; } }