network button accessibility
This commit is contained in:
parent
ebd7757863
commit
08fc19c6a0
2 changed files with 24 additions and 12 deletions
|
@ -87,8 +87,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
if (network.Status == ConnectionStatus.Connected)
|
if (network.Status == ConnectionStatus.Connected)
|
||||||
{
|
{
|
||||||
WirelessIcon.Child = GetWirelessIcon(network.SignalStrength);
|
WirelessIcon.Child = GetWirelessIcon(network.SignalStrength);
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name));
|
||||||
Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, Button.ToolTip as string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WirelessNetworksStackPanel.Children.Add(button);
|
WirelessNetworksStackPanel.Children.Add(button);
|
||||||
|
@ -98,7 +97,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
{
|
{
|
||||||
case ConnectionType.Wired:
|
case ConnectionType.Wired:
|
||||||
Button.IsEnabled = false;
|
Button.IsEnabled = false;
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWiredConnected);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWiredConnected));
|
||||||
WiredIcon.Visibility = Visibility.Visible;
|
WiredIcon.Visibility = Visibility.Visible;
|
||||||
WirelessIcon.Visibility = Visibility.Collapsed;
|
WirelessIcon.Visibility = Visibility.Collapsed;
|
||||||
break;
|
break;
|
||||||
|
@ -109,7 +108,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Button.IsEnabled = false;
|
Button.IsEnabled = false;
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkNotAvailable);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkNotAvailable));
|
||||||
WiredIcon.Visibility = Visibility.Visible;
|
WiredIcon.Visibility = Visibility.Visible;
|
||||||
WirelessIcon.Visibility = Visibility.Collapsed;
|
WirelessIcon.Visibility = Visibility.Collapsed;
|
||||||
break;
|
break;
|
||||||
|
@ -118,19 +117,20 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
switch (adapter.Status)
|
switch (adapter.Status)
|
||||||
{
|
{
|
||||||
case ConnectionStatus.Connected:
|
case ConnectionStatus.Connected:
|
||||||
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWiredConnected));
|
||||||
NetworkStatusIcon.Rotation = 0;
|
NetworkStatusIcon.Rotation = 0;
|
||||||
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Globe, Brushes.Green);
|
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Globe, Brushes.Green);
|
||||||
NetworkStatusIcon.Spin = false;
|
NetworkStatusIcon.Spin = false;
|
||||||
break;
|
break;
|
||||||
case ConnectionStatus.Connecting:
|
case ConnectionStatus.Connecting:
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnecting);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWirelessConnecting));
|
||||||
NetworkStatusIcon.Rotation = 0;
|
NetworkStatusIcon.Rotation = 0;
|
||||||
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Cog, Brushes.DimGray);
|
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Cog, Brushes.DimGray);
|
||||||
NetworkStatusIcon.Spin = true;
|
NetworkStatusIcon.Spin = true;
|
||||||
NetworkStatusIcon.SpinDuration = 2;
|
NetworkStatusIcon.SpinDuration = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkDisconnected);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkDisconnected));
|
||||||
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Ban, Brushes.DarkOrange);
|
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Ban, Brushes.DarkOrange);
|
||||||
NetworkStatusIcon.Spin = false;
|
NetworkStatusIcon.Spin = false;
|
||||||
WirelessIcon.Child = GetWirelessIcon(0);
|
WirelessIcon.Child = GetWirelessIcon(0);
|
||||||
|
@ -138,6 +138,12 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateText(string text)
|
||||||
|
{
|
||||||
|
Button.ToolTip = text;
|
||||||
|
Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text);
|
||||||
|
}
|
||||||
|
|
||||||
private UIElement GetWirelessIcon(int signalStrength)
|
private UIElement GetWirelessIcon(int signalStrength)
|
||||||
{
|
{
|
||||||
var icon = signalStrength > 66 ? "100" : (signalStrength > 33 ? "66" : (signalStrength > 0 ? "33" : "0"));
|
var icon = signalStrength > 66 ? "100" : (signalStrength > 33 ? "66" : (signalStrength > 0 ? "33" : "0"));
|
||||||
|
|
|
@ -87,8 +87,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
|
||||||
if (network.Status == ConnectionStatus.Connected)
|
if (network.Status == ConnectionStatus.Connected)
|
||||||
{
|
{
|
||||||
WirelessIcon.Child = GetWirelessIcon(network.SignalStrength);
|
WirelessIcon.Child = GetWirelessIcon(network.SignalStrength);
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWirelessConnected).Replace("%%NAME%%", network.Name));
|
||||||
Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, Button.ToolTip as string);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WirelessNetworksStackPanel.Children.Add(button);
|
WirelessNetworksStackPanel.Children.Add(button);
|
||||||
|
@ -98,7 +97,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
|
||||||
{
|
{
|
||||||
case ConnectionType.Wired:
|
case ConnectionType.Wired:
|
||||||
Button.IsEnabled = false;
|
Button.IsEnabled = false;
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWiredConnected);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWiredConnected));
|
||||||
WiredIcon.Visibility = Visibility.Visible;
|
WiredIcon.Visibility = Visibility.Visible;
|
||||||
WirelessIcon.Visibility = Visibility.Collapsed;
|
WirelessIcon.Visibility = Visibility.Collapsed;
|
||||||
break;
|
break;
|
||||||
|
@ -109,7 +108,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Button.IsEnabled = false;
|
Button.IsEnabled = false;
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkNotAvailable);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkNotAvailable));
|
||||||
WiredIcon.Visibility = Visibility.Visible;
|
WiredIcon.Visibility = Visibility.Visible;
|
||||||
WirelessIcon.Visibility = Visibility.Collapsed;
|
WirelessIcon.Visibility = Visibility.Collapsed;
|
||||||
break;
|
break;
|
||||||
|
@ -118,19 +117,20 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
|
||||||
switch (adapter.Status)
|
switch (adapter.Status)
|
||||||
{
|
{
|
||||||
case ConnectionStatus.Connected:
|
case ConnectionStatus.Connected:
|
||||||
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWiredConnected));
|
||||||
NetworkStatusIcon.Rotation = 0;
|
NetworkStatusIcon.Rotation = 0;
|
||||||
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Globe, Brushes.Green);
|
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Globe, Brushes.Green);
|
||||||
NetworkStatusIcon.Spin = false;
|
NetworkStatusIcon.Spin = false;
|
||||||
break;
|
break;
|
||||||
case ConnectionStatus.Connecting:
|
case ConnectionStatus.Connecting:
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkWirelessConnecting);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkWirelessConnecting));
|
||||||
NetworkStatusIcon.Rotation = 0;
|
NetworkStatusIcon.Rotation = 0;
|
||||||
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Cog, Brushes.DimGray);
|
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Cog, Brushes.DimGray);
|
||||||
NetworkStatusIcon.Spin = true;
|
NetworkStatusIcon.Spin = true;
|
||||||
NetworkStatusIcon.SpinDuration = 2;
|
NetworkStatusIcon.SpinDuration = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Button.ToolTip = text.Get(TextKey.SystemControl_NetworkDisconnected);
|
UpdateText(text.Get(TextKey.SystemControl_NetworkDisconnected));
|
||||||
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Ban, Brushes.DarkOrange);
|
NetworkStatusIcon.Source = ImageAwesome.CreateImageSource(FontAwesomeIcon.Ban, Brushes.DarkOrange);
|
||||||
NetworkStatusIcon.Spin = false;
|
NetworkStatusIcon.Spin = false;
|
||||||
WirelessIcon.Child = GetWirelessIcon(0);
|
WirelessIcon.Child = GetWirelessIcon(0);
|
||||||
|
@ -138,6 +138,12 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateText(string text)
|
||||||
|
{
|
||||||
|
Button.ToolTip = text;
|
||||||
|
Button.SetValue(System.Windows.Automation.AutomationProperties.NameProperty, text);
|
||||||
|
}
|
||||||
|
|
||||||
private UIElement GetWirelessIcon(int signalStrength)
|
private UIElement GetWirelessIcon(int signalStrength)
|
||||||
{
|
{
|
||||||
var icon = signalStrength > 66 ? "100" : (signalStrength > 33 ? "66" : (signalStrength > 0 ? "33" : "0"));
|
var icon = signalStrength > 66 ? "100" : (signalStrength > 33 ? "66" : (signalStrength > 0 ? "33" : "0"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue