diff --git a/SafeExamBrowser.Proctoring/ProctoringController.cs b/SafeExamBrowser.Proctoring/ProctoringController.cs index f9b5e8df..63ddf825 100644 --- a/SafeExamBrowser.Proctoring/ProctoringController.cs +++ b/SafeExamBrowser.Proctoring/ProctoringController.cs @@ -184,13 +184,18 @@ namespace SafeExamBrowser.Proctoring private void StopProctoring() { - if (window != default(IProctoringWindow)) + if (control != default(ProctoringControl) && window != default(IProctoringWindow)) { - window.Close(); - window = default(IProctoringWindow); - fileSystem.Delete(filePath); + control.Dispatcher.Invoke(() => + { + control.ExecuteScriptAsync("api.executeCommand('hangup'); api.dispose();"); + window.Close(); + control = default(ProctoringControl); + window = default(IProctoringWindow); + fileSystem.Delete(filePath); - logger.Info("Stopped proctoring."); + logger.Info("Stopped proctoring."); + }); } }