//view selected assignment - deadline/questions/Seats/responses DEADLINE private void button3_Click(object sender, RibbonControlEventArgs e) { if (Globals.ThisAddIn.activeDb.Assignments.Any()) { TopViewModel tvm = new TopViewModel(Globals.ThisAddIn.activeDb, (tvm2) => { Globals.ThisAddIn.responsesMarked -= tvm2.updateGrids; }); Globals.ThisAddIn.responsesMarked += tvm.updateGrids; DeadlineQuestionsWindow dqw = new DeadlineQuestionsWindow(tvm); dqw.Show(); } else { System.Windows.MessageBox.Show("you have not assigned any work yet", "", MessageBoxButton.OK); } }
//opens DeadlineQuestionsWindow and hooks up events public SeatResponseWorker(MailItem mi, SchoolContext paramDb) { SchoolContext _db = paramDb; if (mi != null) { PDF _pdfAssignment = OutlookProvider.getAssignmentsFromMailItem(mi).FirstOrDefault(); if (_pdfAssignment != null) { Course course = _db.getCourse(_pdfAssignment, true); Assignment _assignment = _db.getAssignment(_pdfAssignment, course, false); List <OutlookSeat> senderAndRecipients = new List <OutlookSeat>(); senderAndRecipients.AddRange(OutlookSeat.getEmailNames(mi.Recipients)); if (mi.Sender != null) { senderAndRecipients.AddRange(OutlookSeat.getEmailNames(mi.Sender)); } if (_assignment != null) { foreach (OutlookSeat en in senderAndRecipients) { Seat _Seat = _db.getSeat(en, null, false, true); if (_Seat != null) { _deadline = _db.DeadlinesOfSeatAssignment(_Seat, _assignment).LastOrDefault(); if (_deadline != null) { break; } } } } } } DeadlineQuestionsWindow dqw = new DeadlineQuestionsWindow(_db); if (_deadline != null) { TopViewModel top = dqw.DataContext as TopViewModel; top.TCSs.selectedEntity = _deadline.TCS; top.TCSs.selectedViewModel.deadlines.selectedEntity = _deadline; } dqw.Closed += dqw_Closed; dqw.Show(); }
//view TCS/deadlines/Seats/attempts MARKBOOK private void button2_Click(object sender, RibbonControlEventArgs e) { if (Globals.ThisAddIn.activeDb.Groups.Any()) { Thread newWindowThread = new Thread(new ThreadStart(() => { TopViewModel tvm = new TopViewModel(Globals.ThisAddIn.activeDb, (tvm2) => { Globals.ThisAddIn.responsesMarked -= tvm2.updateGrids; }); Globals.ThisAddIn.responsesMarked += tvm.updateGrids; MarkBookWindow mbw = new MarkBookWindow(tvm); Globals.ThisAddIn.Dispatcher.BeginInvoke(() => markbookButton.Enabled = true); mbw.Show(); System.Windows.Threading.Dispatcher.Run(); })); newWindowThread.SetApartmentState(ApartmentState.STA); newWindowThread.IsBackground = true; markbookButton.Enabled = false; newWindowThread.Start(); } else { System.Windows.MessageBox.Show("you have not assigned any work yet", "", MessageBoxButton.OK); } }
public DeadlineQuestionsWindow(TopViewModel topVM) { DataContext = topVM; InitializeComponent(); }
public MarkBookWindow(TopViewModel topVM) { DataContext = topVM; InitializeComponent(); }
public MarkAssignmentWindowOutcomesOnly(TopViewModel tvm) { DataContext = tvm; InitializeComponent(); }