SEBWIN-475: Fixed issue with Zoom client not starting microphone and webcam.

This commit is contained in:
Damian Büchel 2021-06-25 11:51:59 +02:00
parent f0b71ec10c
commit d141b747eb
6 changed files with 50 additions and 1 deletions

View file

@ -74,6 +74,11 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
{ {
settings.Proctoring.WindowVisibility = WindowVisibility.Hidden; settings.Proctoring.WindowVisibility = WindowVisibility.Hidden;
} }
if (settings.Proctoring.Zoom.Enabled && !settings.Proctoring.Zoom.ReceiveVideo)
{
settings.Proctoring.WindowVisibility = WindowVisibility.Hidden;
}
} }
private void RemoveLegacyBrowsers(AppSettings settings) private void RemoveLegacyBrowsers(AppSettings settings)

View file

@ -185,7 +185,14 @@ namespace SafeExamBrowser.Proctoring
if (settings.WindowVisibility == WindowVisibility.AllowToShow || settings.WindowVisibility == WindowVisibility.Hidden) if (settings.WindowVisibility == WindowVisibility.AllowToShow || settings.WindowVisibility == WindowVisibility.Hidden)
{ {
window.Hide(); if (settings.Zoom.Enabled)
{
window.HideWithDelay();
}
else
{
window.Hide();
}
} }
IconResource = new XamlIconResource { Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/ProctoringNotification_Active.xaml") }; IconResource = new XamlIconResource { Uri = new Uri("pack://application:,,,/SafeExamBrowser.UserInterface.Desktop;component/Images/ProctoringNotification_Active.xaml") };

View file

@ -15,6 +15,12 @@ namespace SafeExamBrowser.UserInterface.Contracts.Proctoring
/// </summary> /// </summary>
public interface IProctoringWindow : IWindow public interface IProctoringWindow : IWindow
{ {
/// <summary>
/// First moves the window to the background and then hides it after a timeout. This might be necessary to allow the meeting client to
/// finish its initialization work and start the microphone as well as the camera before being hidden.
/// </summary>
void HideWithDelay();
/// <summary> /// <summary>
/// Sets the window title to the given value. /// Sets the window title to the given value.
/// </summary> /// </summary>

View file

@ -7,6 +7,7 @@
*/ */
using System.ComponentModel; using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using SafeExamBrowser.UserInterface.Contracts.Proctoring; using SafeExamBrowser.UserInterface.Contracts.Proctoring;
using SafeExamBrowser.UserInterface.Contracts.Windows; using SafeExamBrowser.UserInterface.Contracts.Windows;
@ -59,6 +60,12 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
Dispatcher.Invoke(base.Hide); Dispatcher.Invoke(base.Hide);
} }
public void HideWithDelay()
{
Dispatcher.Invoke(() => this.MoveToBackground());
Task.Delay(10000).ContinueWith(_ => Hide());
}
public void SetTitle(string title) public void SetTitle(string title)
{ {
Dispatcher.Invoke(() => Title = title ?? ""); Dispatcher.Invoke(() => Title = title ?? "");

View file

@ -7,6 +7,7 @@
*/ */
using System.ComponentModel; using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using SafeExamBrowser.UserInterface.Contracts.Proctoring; using SafeExamBrowser.UserInterface.Contracts.Proctoring;
using SafeExamBrowser.UserInterface.Contracts.Windows; using SafeExamBrowser.UserInterface.Contracts.Windows;
@ -59,6 +60,12 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
Dispatcher.Invoke(base.Hide); Dispatcher.Invoke(base.Hide);
} }
public void HideWithDelay()
{
Dispatcher.Invoke(() => this.MoveToBackground());
Task.Delay(10000).ContinueWith(_ => Hide());
}
public void SetTitle(string title) public void SetTitle(string title)
{ {
Dispatcher.Invoke(() => Title = title ?? ""); Dispatcher.Invoke(() => Title = title ?? "");

View file

@ -20,8 +20,11 @@ namespace SafeExamBrowser.UserInterface.Shared.Utilities
private const uint MF_GRAYED = 0x00000001; private const uint MF_GRAYED = 0x00000001;
private const uint MF_ENABLED = 0x00000000; private const uint MF_ENABLED = 0x00000000;
private const uint SC_CLOSE = 0xF060; private const uint SC_CLOSE = 0xF060;
private const uint SWP_SHOWWINDOW = 0x0040;
private const int WS_SYSMENU = 0x80000; private const int WS_SYSMENU = 0x80000;
private static readonly IntPtr HWND_BOTTOM = new IntPtr(1);
public static void DisableCloseButton(this Window window) public static void DisableCloseButton(this Window window)
{ {
var helper = new WindowInteropHelper(window); var helper = new WindowInteropHelper(window);
@ -41,6 +44,17 @@ namespace SafeExamBrowser.UserInterface.Shared.Utilities
SetWindowLong(helper.Handle, GWL_STYLE, style); SetWindowLong(helper.Handle, GWL_STYLE, style);
} }
public static void MoveToBackground(this Window window)
{
var helper = new WindowInteropHelper(window);
var x = (int) window.TransformFromPhysical(window.Left, 0).X;
var y = (int) window.TransformFromPhysical(0, window.Top).Y;
var width = (int) window.TransformFromPhysical(window.Width, 0).X;
var height = (int) window.TransformFromPhysical(0, window.Height).Y;
SetWindowPos(helper.Handle, HWND_BOTTOM, x, y, width, height, SWP_SHOWWINDOW);
}
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem, uint uEnable); private static extern bool EnableMenuItem(IntPtr hMenu, uint uIDEnableItem, uint uEnable);
@ -52,5 +66,8 @@ namespace SafeExamBrowser.UserInterface.Shared.Utilities
[DllImport("user32.dll")] [DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll")]
private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
} }
} }