SEBWIN-734: Fixed status info in Action Center WLAN control when WLAN enabled but connected to wired network.

This commit is contained in:
Damian Büchel 2023-11-01 09:22:24 +01:00
parent 400b259af7
commit ca02b1d674
4 changed files with 35 additions and 45 deletions

View file

@ -41,14 +41,16 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
private void InitializeWirelessNetworkControl()
{
var lastOpenedBySpacePress = false;
var originalBrush = Grid.Background;
adapter.Changed += () => Dispatcher.InvokeAsync(Update);
Button.Click += (o, args) => Popup.IsOpen = !Popup.IsOpen;
var lastOpenedBySpacePress = false;
Button.PreviewKeyDown += (o, args) =>
{
if (args.Key == System.Windows.Input.Key.Space) // for some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation, we record the space bar event and leave the popup open for at least 3 seconds
// For some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation,
// we record the space bar event and leave the popup open for at least 3 seconds.
if (args.Key == System.Windows.Input.Key.Space)
{
lastOpenedBySpacePress = true;
}
@ -76,11 +78,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
(WirelessNetworksStackPanel.Children[0] as NetworkButton)?.SetFocus();
}
}));
};
@ -137,6 +135,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
switch (adapter.Status)
{
case ConnectionStatus.Connected:
UpdateText(text.Get(TextKey.SystemControl_NetworkWiredConnected));
NetworkStatusIcon.Rotation = 0;
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Globe, Brushes.Green);
NetworkStatusIcon.Spin = false;

View file

@ -42,13 +42,15 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
private void InitializeWirelessNetworkControl()
{
var lastOpenedBySpacePress = false;
var originalBrush = Button.Background;
adapter.Changed += () => Dispatcher.InvokeAsync(Update);
var lastOpenedBySpacePress = false;
Button.PreviewKeyDown += (o, args) =>
{
if (args.Key == System.Windows.Input.Key.Space) // for some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation, we record the space bar event and leave the popup open for at least 3 seconds
// For some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation,
// we record the space bar event and leave the popup open for at least 3 seconds
if (args.Key == System.Windows.Input.Key.Space)
{
lastOpenedBySpacePress = true;
}
@ -62,6 +64,12 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
}
Popup.IsOpen = Popup.IsMouseOver;
}));
Popup.Closed += (o, args) =>
{
Background = originalBrush;
Button.Background = originalBrush;
lastOpenedBySpacePress = false;
};
Popup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(Popup_PlacementCallback);
Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() =>
{
@ -71,8 +79,6 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
}
Popup.IsOpen = IsMouseOver;
}));
WirelessIcon.Child = GetWirelessIcon(0);
Popup.Opened += (o, args) =>
{
Background = Brushes.LightGray;
@ -81,21 +87,11 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
(WirelessNetworksStackPanel.Children[0] as NetworkButton)?.SetFocus();
}
}));
};
Popup.Closed += (o, args) =>
{
Background = originalBrush;
Button.Background = originalBrush;
lastOpenedBySpacePress = false;
};
WirelessIcon.Child = GetWirelessIcon(0);
Update();
}

View file

@ -48,7 +48,9 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
var lastOpenedBySpacePress = false;
Button.PreviewKeyDown += (o, args) =>
{
if (args.Key == System.Windows.Input.Key.Space) // for some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation, we record the space bar event and leave the popup open for at least 3 seconds
// For some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation,
// we record the space bar event and leave the popup open for at least 3 seconds.
if (args.Key == System.Windows.Input.Key.Space)
{
lastOpenedBySpacePress = true;
}
@ -76,11 +78,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
(WirelessNetworksStackPanel.Children[0] as NetworkButton)?.SetFocus();
}
}));
};
@ -137,6 +135,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
switch (adapter.Status)
{
case ConnectionStatus.Connected:
UpdateText(text.Get(TextKey.SystemControl_NetworkWiredConnected));
NetworkStatusIcon.Rotation = 0;
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Globe, Brushes.Green);
NetworkStatusIcon.Spin = false;

View file

@ -42,14 +42,16 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
private void InitializeWirelessNetworkControl()
{
var lastOpenedBySpacePress = false;
var originalBrush = Button.Background;
adapter.Changed += () => Dispatcher.InvokeAsync(Update);
Button.Click += (o, args) => Popup.IsOpen = !Popup.IsOpen;
var lastOpenedBySpacePress = false;
Button.PreviewKeyDown += (o, args) =>
{
if (args.Key == System.Windows.Input.Key.Space) // for some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation, we record the space bar event and leave the popup open for at least 3 seconds
// For some reason, the popup immediately closes again if opened by a Space Bar key event - as a mitigation,
// we record the space bar event and leave the popup open for at least 3 seconds.
if (args.Key == System.Windows.Input.Key.Space)
{
lastOpenedBySpacePress = true;
}
@ -62,6 +64,12 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
}
Popup.IsOpen = Popup.IsMouseOver;
}));
Popup.Closed += (o, args) =>
{
Background = originalBrush;
Button.Background = originalBrush;
lastOpenedBySpacePress = false;
};
Popup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(Popup_PlacementCallback);
Popup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() =>
{
@ -71,8 +79,6 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
}
Popup.IsOpen = IsMouseOver;
}));
WirelessIcon.Child = GetWirelessIcon(0);
Popup.Opened += (o, args) =>
{
Background = Brushes.LightGray;
@ -81,21 +87,11 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
{
if (WirelessNetworksStackPanel.Children.Count > 0)
{
var btn = WirelessNetworksStackPanel.Children[0] as NetworkButton;
if (btn != null)
{
btn.SetFocus();
}
(WirelessNetworksStackPanel.Children[0] as NetworkButton)?.SetFocus();
}
}));
};
Popup.Closed += (o, args) =>
{
Background = originalBrush;
Button.Background = originalBrush;
lastOpenedBySpacePress = false;
};
WirelessIcon.Child = GetWirelessIcon(0);
Update();
}