SEBWIN-384: Ensured the action center is automatically hidden during shell initialization.

This commit is contained in:
Damian Büchel 2020-04-01 13:49:32 +02:00
parent 3840fb4e84
commit 735e0b6dca
5 changed files with 34 additions and 2 deletions

View file

@ -946,12 +946,14 @@ namespace SafeExamBrowser.Client.UnitTests
settings.ActionCenter.EnableActionCenter = true; settings.ActionCenter.EnableActionCenter = true;
sut.TryStart(); sut.TryStart();
actionCenter.Verify(t => t.Show(), Times.Once); actionCenter.Verify(t => t.Promote(), Times.Once);
actionCenter.Verify(t => t.Show(), Times.Never);
actionCenter.Reset(); actionCenter.Reset();
operationSequence.Setup(o => o.TryPerform()).Returns(OperationResult.Aborted); operationSequence.Setup(o => o.TryPerform()).Returns(OperationResult.Aborted);
sut.TryStart(); sut.TryStart();
actionCenter.Verify(t => t.Promote(), Times.Never);
actionCenter.Verify(t => t.Show(), Times.Never); actionCenter.Verify(t => t.Show(), Times.Never);
actionCenter.Reset(); actionCenter.Reset();
@ -959,6 +961,7 @@ namespace SafeExamBrowser.Client.UnitTests
operationSequence.Setup(o => o.TryPerform()).Returns(OperationResult.Success); operationSequence.Setup(o => o.TryPerform()).Returns(OperationResult.Success);
sut.TryStart(); sut.TryStart();
actionCenter.Verify(t => t.Promote(), Times.Never);
actionCenter.Verify(t => t.Show(), Times.Never); actionCenter.Verify(t => t.Show(), Times.Never);
} }

View file

@ -238,7 +238,7 @@ namespace SafeExamBrowser.Client
{ {
if (Settings.ActionCenter.EnableActionCenter) if (Settings.ActionCenter.EnableActionCenter)
{ {
actionCenter.Show(); actionCenter.Promote();
} }
if (Settings.Taskbar.EnableTaskbar) if (Settings.Taskbar.EnableTaskbar)

View file

@ -61,6 +61,11 @@ namespace SafeExamBrowser.UserInterface.Contracts.Shell
/// </summary> /// </summary>
void InitializeText(IText text); void InitializeText(IText text);
/// <summary>
/// Makes the action center visible and automatically hides it after a short delay.
/// </summary>
void Promote();
/// <summary> /// <summary>
/// Registers the specified activator to control the visibility of the action center. /// Registers the specified activator to control the visibility of the action center.
/// </summary> /// </summary>

View file

@ -7,6 +7,8 @@
*/ */
using System; using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
@ -87,6 +89,16 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
QuitButton.Text.Text = text.Get(TextKey.Shell_QuitButton); QuitButton.Text.Text = text.Get(TextKey.Shell_QuitButton);
} }
public void Promote()
{
Task.Run(() =>
{
Dispatcher.Invoke(ShowAnimated);
Thread.Sleep(2000);
Dispatcher.Invoke(HideAnimated);
});
}
public void Register(IActionCenterActivator activator) public void Register(IActionCenterActivator activator)
{ {
activator.Activated += Activator_Activated; activator.Activated += Activator_Activated;

View file

@ -7,6 +7,8 @@
*/ */
using System; using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Media.Animation; using System.Windows.Media.Animation;
using SafeExamBrowser.I18n.Contracts; using SafeExamBrowser.I18n.Contracts;
@ -87,6 +89,16 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows
QuitButton.Text.Text = text.Get(TextKey.Shell_QuitButton); QuitButton.Text.Text = text.Get(TextKey.Shell_QuitButton);
} }
public void Promote()
{
Task.Run(() =>
{
Dispatcher.Invoke(ShowAnimated);
Thread.Sleep(2000);
Dispatcher.Invoke(HideAnimated);
});
}
public void Register(IActionCenterActivator activator) public void Register(IActionCenterActivator activator)
{ {
activator.Activated += Activator_Activated; activator.Activated += Activator_Activated;