// Load the revision window for the selected test private void btnRevise_Click(object sender, RoutedEventArgs e) { // Simple selection validation if (lstTests_Revise.SelectedIndex == -1) { App.Message("Sorry, I don't know what to do.", "Please select a test to revise."); return; } // Cast it to a test and open the revision window and show it Test reviseTest = (Test)lstTests_Revise.SelectedItem; SitTestWindow stw = new SitTestWindow('r', reviseTest, login); stw.ShowDialog(); }
private void btnTake_Click(object sender, RoutedEventArgs e) { // Make sure they've selected one if (lstTests_Take.SelectedIndex == -1) { App.Message("Sorry, I don't know what to do.", "Please select a test to sit."); return; } // Cast selection to a test and open the take test window, and also show it. Test takeTest = (Test)lstTests_Take.SelectedItem; SitTestWindow stw = new SitTestWindow('t', takeTest, login); stw.ShowDialog(); // Update the tests lists, so that if they finished it they can't sit it again. updateTestsList(); }