diff --git a/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs index 099b0239..0cb17a58 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Controls/ActionCenter/NetworkControl.xaml.cs @@ -74,10 +74,13 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter Grid.Background = Brushes.Gray; Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => { - var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; - if (btn != null) + if (WirelessNetworksStackPanel.Children.Count > 0) { - btn.SetFocus(); + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } } })); }; diff --git a/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs index 4cc6793b..b9bf15d9 100644 --- a/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Desktop/Controls/Taskbar/NetworkControl.xaml.cs @@ -79,10 +79,13 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar Button.Background = Brushes.LightGray; Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => { - var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; - if (btn != null) + if (WirelessNetworksStackPanel.Children.Count > 0) { - btn.SetFocus(); + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } } })); }; diff --git a/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs index 349418b4..9231578b 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Controls/ActionCenter/NetworkControl.xaml.cs @@ -74,10 +74,13 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter Grid.Background = Brushes.Gray; Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => { - var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; - if (btn != null) + if (WirelessNetworksStackPanel.Children.Count > 0) { - btn.SetFocus(); + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } } })); }; diff --git a/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs index 7b21a7e3..89360a6a 100644 --- a/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs +++ b/SafeExamBrowser.UserInterface.Mobile/Controls/Taskbar/NetworkControl.xaml.cs @@ -79,10 +79,13 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar Button.Background = Brushes.LightGray; Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() => { - var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; - if (btn != null) + if (WirelessNetworksStackPanel.Children.Count > 0) { - btn.SetFocus(); + var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton; + if (btn != null) + { + btn.SetFocus(); + } } })); };