Example #1
0
        private void date_clicked(object sender, SelectionChangedEventArgs e) //
        {
            var calendar = sender as Calendar;

            if (calendar.SelectedDate.HasValue)
            {
                DateTime          date = calendar.SelectedDate.Value;
                List <Assignment> todays_assignments = check_date_due(date);
                string            title = check_today(date.ToShortDateString());

                if (todays_assignments.Count != 0)
                {
                    string show = "Due Today: \n \n";

                    foreach (var Assignment in todays_assignments)
                    {
                        show += Assignment.ClassName;
                        show += ": \n";
                        show += Assignment.AssignName;
                        show += "\n -";

                        if (Assignment.Notes != "")
                        {
                            show += Assignment.Notes;
                            show += "\n";
                        }
                        else
                        {
                            show += "No Notes \n";
                        }
                        show += "\n";
                    }
                    MessageBox.Show(show);
                }
                else
                {
                    MessageBoxResult result = MessageBox.Show("There is no assignment for the selected date, would you like to add one?", title, MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        StudentAssignments student = new StudentAssignments(title);
                        student.ShowDialog();
                        viewCompletedAssignments.Items.Clear();
                        open_completed_file();
                        viewPastDue.Items.Clear();
                        open_assignments_file();
                        Calendar.SelectedDates.Clear();
                    }
                }
                Calendar.SelectedDates.Clear();
            }
        }
Example #2
0
        private void assignments_click(object sender, RoutedEventArgs e) //opens the window to display assignments
        {
            string             date    = "";
            StudentAssignments student = new StudentAssignments(date);

            student.ShowDialog();
            viewCompletedAssignments.Items.Clear();
            open_completed_file();
            viewPastDue.Items.Clear();
            MyAssignments.Clear();
            due_today.Items.Clear();
            background.ClearDates();
            open_assignments_file();
        }