private async void AppBarButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            if (App.Timetable.Subjects.Any())
            {
                var viewModel = ((HomeworkOverviewPageViewModel)this.DataContext);

                var subject = App.Timetable.Subjects.First();

                if (this.DataPivot.SelectedItem == FilteredPivotItem && viewModel.HomeworkFilter != viewModel.NoFilterSubject)
                    subject = App.Timetable.Subjects[viewModel.HomeworkFilter.GetIndex(App.Timetable.Subjects)];

                var homework = new Homework(subject);
                homework.FromDate = DateTime.Today;
                homework.ToDate = App.Timetable.GetNextDate(subject, LessonViewModel.GetIsOddWeek());
                App.Timetable.Homeworks.Add(homework);

                Frame.Navigate(typeof(EditHomeworkPage), App.Timetable.Homeworks.IndexOf(homework));
            }
            else
            {
                await new MessageDialog(Strings.PageHomeworkOverviewNoSubjectWarning, Strings.MessageBoxWarningCaption).ShowAsync();
                Frame.Navigate(typeof(GeneralDataEditor));
            }
        }
 public EditHomeworkPageViewModel(Homework homework, Timetable timetable)
     : base(homework)
 {
     this.Subjects = new ReadOnlyCollection<SubjectViewModel>(timetable.Subjects.Select(p => new SubjectViewModel(p)).ToList());
 }