コード例 #1
0
        public void Initialize(ProctoringSettings settings)
        {
            var control = new ProctoringControl();

            window = uiFactory.CreateProctoringWindow(control);
            window.Show();
        }
コード例 #2
0
        private void StartProctoring()
        {
            Application.Current.Dispatcher.Invoke(() =>
            {
                try
                {
                    var content = LoadContent(settings);

                    filePath = Path.Combine(appConfig.TemporaryDirectory, $"{Path.GetRandomFileName()}_index.html");
                    fileSystem.Save(content, filePath);

                    control = new ProctoringControl(logger.CloneFor(nameof(ProctoringControl)));
                    control.EnsureCoreWebView2Async().ContinueWith(_ =>
                    {
                        control.Dispatcher.Invoke(() =>
                        {
                            control.CoreWebView2.Navigate(filePath);
                        });
                    });

                    window = uiFactory.CreateProctoringWindow(control);
                    window.SetTitle(settings.JitsiMeet.Enabled ? settings.JitsiMeet.Subject : settings.Zoom.UserName);
                    window.Show();

                    if (settings.WindowVisibility == WindowVisibility.AllowToShow || settings.WindowVisibility == WindowVisibility.Hidden)
                    {
                        window.Hide();
                    }

                    IconResource = new XamlIconResource {
                        Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/ProctoringNotification_Active.xaml")
                    };
                    Tooltip = text.Get(TextKey.Notification_ProctoringActiveTooltip);
                    NotificationChanged?.Invoke();

                    logger.Info($"Started proctoring with {(settings.JitsiMeet.Enabled ? "Jitsi Meet" : "Zoom")}.");
                }
                catch (Exception e)
                {
                    logger.Error($"Failed to start proctoring! Reason: {e.Message}", e);
                }
            });
        }