fix possible IndexOutOfRangeException

This commit is contained in:
Jonas Sourlier 2023-03-06 17:03:01 +01:00
parent 3ca514e653
commit 298e8f34f4
4 changed files with 24 additions and 12 deletions

View file

@ -73,12 +73,15 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
{
Grid.Background = Brushes.Gray;
Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() =>
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
}
}));
};
Popup.Closed += (o, args) =>

View file

@ -78,12 +78,15 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
Background = Brushes.LightGray;
Button.Background = Brushes.LightGray;
Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() =>
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
}
}));
};

View file

@ -73,12 +73,15 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
{
Grid.Background = Brushes.Gray;
Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() =>
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
}
}));
};
Popup.Closed += (o, args) =>

View file

@ -78,12 +78,15 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
Background = Brushes.LightGray;
Button.Background = Brushes.LightGray;
Task.Delay(100).ContinueWith((task) => Dispatcher.Invoke(() =>
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
}
}));
};