private void LoadIcon()
        {
            var uri      = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/ShutDown.xaml");
            var resource = new XamlIconResource(uri);

            Button.Content = IconResourceLoader.Load(resource);
        }
Exemplo n.º 2
0
        private void InitializeAudioControl()
        {
            var originalBrush = Grid.Background;

            audio.VolumeChanged += Audio_VolumeChanged;
            Button.Click        += (o, args) => Popup.IsOpen = !Popup.IsOpen;
            Button.MouseLeave   += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = Popup.IsMouseOver));
            MuteButton.Click    += MuteButton_Click;
            MutedIcon            = new XamlIconResource(new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/Audio_Muted.xaml"));
            NoDeviceIcon         = new XamlIconResource(new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/Audio_Light_NoDevice.xaml"));
            Popup.MouseLeave    += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => Popup.IsOpen = IsMouseOver));
            Popup.Opened        += (o, args) => Grid.Background = Brushes.Gray;
            Popup.Closed        += (o, args) => Grid.Background = originalBrush;
            Volume.ValueChanged += Volume_ValueChanged;

            if (audio.HasOutputDevice)
            {
                AudioDeviceName.Text = audio.DeviceFullName;
                Button.IsEnabled     = true;
                UpdateVolume(audio.OutputVolume, audio.OutputMuted);
            }
            else
            {
                AudioDeviceName.Text = text.Get(TextKey.SystemControl_AudioDeviceNotFound);
                Button.IsEnabled     = false;
                Button.ToolTip       = text.Get(TextKey.SystemControl_AudioDeviceNotFound);
                ButtonIcon.Content   = IconResourceLoader.Load(NoDeviceIcon);
                Text.Text            = text.Get(TextKey.SystemControl_AudioDeviceNotFound);
            }
        }
        private UIElement GetIcon(int signalStrength)
        {
            var icon     = signalStrength > 66 ? "100" : (signalStrength > 33 ? "66" : (signalStrength > 0 ? "33" : "0"));
            var uri      = new Uri($"pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/WiFi_Light_{icon}.xaml");
            var resource = new XamlIconResource(uri);

            return(IconResourceLoader.Load(resource));
        }
        private void InitializeControl()
        {
            var uri      = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/ShutDown.xaml");
            var resource = new XamlIconResource(uri);

            Icon.Content  = IconResourceLoader.Load(resource);
            Button.Click += (o, args) => Clicked?.Invoke(new CancelEventArgs());
        }
Exemplo n.º 5
0
        private UIElement LoadIcon(double volume)
        {
            var icon     = volume > 0.66 ? "100" : (volume > 0.33 ? "66" : "33");
            var uri      = new Uri($"pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/Audio_Light_{icon}.xaml");
            var resource = new XamlIconResource(uri);

            return(IconResourceLoader.Load(resource));
        }
Exemplo n.º 6
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);
                }
            });
        }
Exemplo n.º 7
0
        public ProctoringController(
            AppConfig appConfig,
            IFileSystem fileSystem,
            IModuleLogger logger,
            IServerProxy server,
            IText text,
            IUserInterfaceFactory uiFactory)
        {
            this.appConfig  = appConfig;
            this.fileSystem = fileSystem;
            this.logger     = logger;
            this.server     = server;
            this.text       = text;
            this.uiFactory  = uiFactory;

            IconResource = new XamlIconResource {
                Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/ProctoringNotification_Inactive.xaml")
            };
            Tooltip = text.Get(TextKey.Notification_ProctoringInactiveTooltip);
        }