Exemple #1
0
        private void DeleteClick(object sender, RoutedEventArgs e)
        {
            Button    button = (Button)sender;
            Classwork cw     = (Classwork)button.DataContext;

            Globals.cwList.DeleteClasswork(cw);
        }
Exemple #2
0
        private void EditClick(object sender, RoutedEventArgs e)
        {
            Button         button = (Button)sender;
            Classwork      cw     = (Classwork)button.DataContext;
            EditAssignment edit   = new EditAssignment(cw);

            edit.Show();
        }
Exemple #3
0
        public Notification(Classwork cw)
        {
            InitializeComponent();
            cbSnooze.SelectedIndex = 0;        // 15 minutes by default
            TimeSpan snooze = new TimeSpan(0); // no time at all unless snooze is hit

            classwork = cw;
        }
Exemple #4
0
 public bool DeleteClasswork(Classwork work)
 {
     if (work != null)
     {
         Globals.gradebook.RemoveAll(x => x.gradeID == work.GradeID);
     }
     return(this.classwork.Remove(work));
 }
Exemple #5
0
 public EditAssignment(Classwork cw)
 {
     tempGrade = Globals.gradebook.grades.FirstOrDefault(g => g.gradeID == cw.GradeID);
     InitializeComponent();
     this.classwrk             = cw;
     tbAssignmentName.Text     = cw.Name;
     cmbClasses.ItemsSource    = Globals.clList.classes;
     cmbClasses.SelectedItem   = Globals.clList.classes.FirstOrDefault(x => x.Name == cw.Cl);
     dpDueDate.DefaultValue    = cw.DueDate;
     dpNoteTime.DefaultValue   = cw.NotificationTime;
     cmbPriority.SelectedIndex = cw.Priority - 1;
     cbAutoIncrement.IsChecked = cw.AutoIncrement;
     tbAutoIncrementDays.Text  = cw.AutoIncrementDays.ToString();
     cmbType.SelectedIndex     = (int)cw.Type;
     cbComplete.IsChecked      = cw.Completed;
 }
Exemple #6
0
        private void SaveClick(object sender, RoutedEventArgs e)
        {
            Globals.cwList.DeleteClasswork(classwrk);

            string name = tbAssignmentName.Text;
            //string grade = tbGrade.Text;
            string        autoIncrementDays = tbAutoIncrementDays.Text;
            ClassworkType type = ClassworkType.Assignment;

            switch (cmbType.SelectedIndex)
            {
            case 0:
                type = ClassworkType.Assignment;
                break;

            case 1:
                type = ClassworkType.Assessment;
                break;

            case 2:
                type = ClassworkType.ExtraCredit;
                break;
            }
            int autoIncDays = 0;

            try { autoIncDays = int.Parse(tbAutoIncrementDays.Text); } catch (Exception) { }

            DateTime?notifTime = dpNoteTime.Value;
            DateTime?dueDate   = dpDueDate.Value;

            string cl;

            try
            {
                cl = ((Class)cmbClasses.SelectedItem).Name;
                if (tempGrade == null)
                {
                    tempGrade = new Grade(cl, dueDate);
                }
            }
            catch (NullReferenceException)
            {
                cl        = null;
                tempGrade = null;
            }

            Classwork tempClasswork;

            if (tempGrade != null)
            {
                tempClasswork = new Classwork(
                    name, cl, dueDate, cmbPriority.SelectedIndex + 1, tempGrade.gradeID, (bool)cbAutoIncrement.IsChecked, autoIncDays, type, notifTime);
                tempGrade.Name  = tbAssignmentName.Text;
                tempGrade.cwID  = tempClasswork.CWID;
                tempGrade.Hours = ((Class)cmbClasses.SelectedItem).CreditHours;
                Globals.gradebook.AddGrade(tempGrade);
            }
            else
            {
                tempClasswork = new Classwork(
                    name, cl, dueDate, cmbPriority.SelectedIndex + 1, Guid.Empty, (bool)cbAutoIncrement.IsChecked, autoIncDays, type, notifTime);
            }

            if ((bool)cbComplete.IsChecked)
            {
                tempClasswork.Completed = true;
            }

            createdCW = tempClasswork;
            Globals.cwList.AddClasswork(tempClasswork);

            this.Close();
        }
Exemple #7
0
 public void AddClasswork(Classwork work)
 {
     this.classwork.Add(work);
 }
Exemple #8
0
 public static void showNotification(Classwork classwork)
 {
     classwork.ShowNotification();
 }
Exemple #9
0
 public Grade GetGradeForClasswork(Classwork classwork)
 {
     //Not implemented
     return(null);
 }