private void TryAskForExamSelectionViaClient(ExamSelectionEventArgs args) { var exams = args.Exams.Select(e => (e.Id, e.LmsName, e.Name, e.Url)); var requestId = Guid.NewGuid(); var response = default(ExamSelectionReplyEventArgs); var responseEvent = new AutoResetEvent(false); var responseEventHandler = new CommunicationEventHandler <ExamSelectionReplyEventArgs>((a) => { if (a.RequestId == requestId) { response = a; responseEvent.Set(); } }); runtimeHost.ExamSelectionReceived += responseEventHandler; var communication = sessionContext.ClientProxy.RequestExamSelection(exams, requestId); if (communication.Success) { responseEvent.WaitOne(); args.SelectedExam = args.Exams.First(e => e.Id == response.SelectedExamId); args.Success = response.Success; } else { args.SelectedExam = default(Exam); args.Success = false; } runtimeHost.ExamSelectionReceived -= responseEventHandler; }
private void TryAskForExamSelectionViaDialog(ExamSelectionEventArgs args) { var dialog = uiFactory.CreateExamSelectionDialog(args.Exams); var result = dialog.Show(runtimeWindow); args.SelectedExam = result.SelectedExam; args.Success = result.Success; }
private void AskForExamSelection(ExamSelectionEventArgs args) { var isStartup = !SessionIsRunning; var isRunningOnDefaultDesktop = SessionIsRunning && Session.Settings.Security.KioskMode == KioskMode.DisableExplorerShell; if (isStartup || isRunningOnDefaultDesktop) { TryAskForExamSelectionViaDialog(args); } else { TryAskForExamSelectionViaClient(args); } }