SEBWIN-141: Fixed issue with flickering / unintentional hiding of action center.

This commit is contained in:
dbuechel 2019-03-07 08:57:17 +01:00
parent 1625e7fa2b
commit 1991f9c2d1

View file

@ -18,7 +18,6 @@ namespace SafeExamBrowser.UserInterface.Desktop
public ActionCenter()
{
InitializeComponent();
RegisterEvents();
}
public new void Close()
@ -58,7 +57,7 @@ namespace SafeExamBrowser.UserInterface.Desktop
Storyboard.SetTargetProperty(animation, new PropertyPath(LeftProperty));
storyboard.Children.Add(animation);
storyboard.Completed += (o, args) => Dispatcher.Invoke(base.Hide);
storyboard.Completed += HideAnimation_Completed;
storyboard.Begin();
}
@ -78,10 +77,9 @@ namespace SafeExamBrowser.UserInterface.Desktop
InitializeBounds();
base.Show();
Activate();
storyboard.Children.Add(animation);
storyboard.Completed += (o, args) => Dispatcher.Invoke(Activate);
storyboard.Completed += ShowAnimation_Completed;
storyboard.Begin();
}
@ -92,9 +90,21 @@ namespace SafeExamBrowser.UserInterface.Desktop
Left = -Width;
}
private void RegisterEvents()
private void ShowAnimation_Completed(object sender, EventArgs e)
{
Deactivated += (o, args) => HideAnimated();
Activate();
Deactivated += ActionCenter_Deactivated;
}
private void HideAnimation_Completed(object sender, EventArgs e)
{
Deactivated -= ActionCenter_Deactivated;
base.Hide();
}
private void ActionCenter_Deactivated(object sender, EventArgs e)
{
HideAnimated();
}
private void Activator_Activate()