Example #1
0
 public SocketClient(NotificationChanged pListener, NotificationDisconnect pNotification, Socket socket)
 {
     listenerDisconnect = pNotification;
     listenerChanged = pListener;
     this.socket = socket;
     StartReceive();
 }
Example #2
0
        public void RemoveEveryObserver()
        {
            ObserverCount = 0;
            RemoveEveryObserver(handle, handle);
            var evt = NotificationChanged.GetInvocationList();

            foreach (var e in evt)
            {
                NotificationChanged -= (NotificationChangeEventHandler)e;
            }

            if (centers.ContainsKey(handle))
            {
                centers.Remove(handle);
            }
        }
Example #3
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);
                }
            });
        }
        private void OnNotificationClosed(BaseNotification notification)
        {
            if (notification is null)
            {
                return;
            }

            notification.Closed -= OnNotificationClosed;


            // remove associated config
            if (_configs.TryGetValue(notification, out var config) && config != null)
            {
                config.Created -= OnNotificationCreated;
                _configs.Remove(notification);
            }

            NotificationChanged?.Invoke(this, new NotificationChanged(ChangeType.Remove, notification));
        }
        private void OnNotificationCreated(BaseNotification baseNotification)
        {
            if (baseNotification is null)
            {
                return;
            }

            baseNotification.Closed += OnNotificationClosed;

            switch (baseNotification)
            {
            case Notification notification:
                _notifications.Add(notification);
                break;

            case TaskNotification taskNotification:
                _tasks.Add(taskNotification);
                break;
            }

            NotificationChanged?.Invoke(this, new NotificationChanged(ChangeType.Add, baseNotification));
        }
Example #6
0
 public void setListenerComunication(NotificationChanged pListener)
 {
     listener = pListener;
 }
Example #7
0
 public ServerSocket(Utils.ConfigureXml _Config, NotificationChanged pListener)
 {
     config = _Config;
     listener = pListener;
     //this.StartListening();
 }