From bb0f679c6b067bc5213f51346bc83bdf10150104 Mon Sep 17 00:00:00 2001 From: Jonas Sourlier Date: Tue, 25 Oct 2022 13:14:59 +0200 Subject: [PATCH 1/2] fix https://github.com/SafeExamBrowser/seb-win-refactoring/issues/490 --- .../Windows/Taskbar.xaml.cs | 5 ++++- SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs index 78ad173b..e1937348 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs @@ -91,7 +91,10 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows if (forward) { - SetFocusWithin(ApplicationStackPanel.Children[0]); + if (ApplicationStackPanel.Children.Count > 0) + { + SetFocusWithin(ApplicationStackPanel.Children[0]); + } } else { diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs index 24040923..18f4665b 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs @@ -90,7 +90,10 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows if (fromTop) { - ApplicationStackPanel.Children[0].Focus(); + if (ApplicationStackPanel.Children.Count > 0) + { + ApplicationStackPanel.Children[0].Focus(); + } } else { From 878ac29fe07ed3890265c0f2f28fa990737bdd88 Mon Sep 17 00:00:00 2001 From: Jonas Sourlier Date: Thu, 27 Oct 2022 10:27:55 +0200 Subject: [PATCH 2/2] combine if statements --- .../Windows/Taskbar.xaml.cs | 7 ++----- .../Windows/Taskbar.xaml.cs | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs index e1937348..6e823b3e 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Windows/Taskbar.xaml.cs @@ -89,12 +89,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows { Activate(); - if (forward) + if (forward && ApplicationStackPanel.Children.Count > 0) { - if (ApplicationStackPanel.Children.Count > 0) - { - SetFocusWithin(ApplicationStackPanel.Children[0]); - } + SetFocusWithin(ApplicationStackPanel.Children[0]); } else { diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs index 18f4665b..e64d3b8b 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Windows/Taskbar.xaml.cs @@ -88,12 +88,9 @@ namespace SafeExamBrowser.UserInterface.Mobile.Windows { Activate(); - if (fromTop) + if (fromTop && ApplicationStackPanel.Children.Count > 0) { - if (ApplicationStackPanel.Children.Count > 0) - { - ApplicationStackPanel.Children[0].Focus(); - } + ApplicationStackPanel.Children[0].Focus(); } else {