work on accessibility

This commit is contained in:
Jonas Sourlier 2022-11-08 11:02:56 +01:00
parent 900115d66c
commit 14ef0a2b2a
8 changed files with 36 additions and 10 deletions

View file

@ -35,7 +35,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
Icon.Content = IconResourceLoader.Load(window?.Icon ?? application.Icon); Icon.Content = IconResourceLoader.Load(window?.Icon ?? application.Icon);
Text.Text = window?.Title ?? application.Name; Text.Text = window?.Title ?? application.Name;
Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty); Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty);
Button.ToolTip = window?.Title ?? application.Tooltip; var tooltip = window?.Title ?? application.Tooltip;
Button.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(Button, tooltip);
if (window != null) if (window != null)
{ {

View file

@ -114,6 +114,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
this.muted = muted; this.muted = muted;
Button.ToolTip = info; Button.ToolTip = info;
System.Windows.Automation.AutomationProperties.SetName(Button, info);
Text.Text = info; Text.Text = info;
Volume.ValueChanged -= Volume_ValueChanged; Volume.ValueChanged -= Volume_ValueChanged;
Volume.Value = Math.Round(volume * 100); Volume.Value = Math.Round(volume * 100);
@ -121,14 +122,18 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter
if (muted) if (muted)
{ {
var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); ButtonIcon.Content = IconResourceLoader.Load(MutedIcon);
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip);
PopupIcon.Content = IconResourceLoader.Load(MutedIcon); PopupIcon.Content = IconResourceLoader.Load(MutedIcon);
} }
else else
{ {
var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
ButtonIcon.Content = LoadIcon(volume); ButtonIcon.Content = LoadIcon(volume);
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip);
PopupIcon.Content = LoadIcon(volume); PopupIcon.Content = LoadIcon(volume);
} }
} }

View file

@ -44,6 +44,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
Button.MouseEnter += (o, args) => WindowPopup.IsOpen = WindowStackPanel.Children.Count > 0; Button.MouseEnter += (o, args) => WindowPopup.IsOpen = WindowStackPanel.Children.Count > 0;
Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = WindowPopup.IsMouseOver || ActiveBar.IsMouseOver)); Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = WindowPopup.IsMouseOver || ActiveBar.IsMouseOver));
Button.ToolTip = application.Tooltip; Button.ToolTip = application.Tooltip;
System.Windows.Automation.AutomationProperties.SetName(Button, application.Tooltip);
WindowPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(WindowPopup_PlacementCallback); WindowPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(WindowPopup_PlacementCallback);
WindowPopup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = IsMouseOver)); WindowPopup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = IsMouseOver));

View file

@ -132,19 +132,24 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
this.muted = muted; this.muted = muted;
Button.ToolTip = info; Button.ToolTip = info;
System.Windows.Automation.AutomationProperties.SetName(Button, info);
Volume.ValueChanged -= Volume_ValueChanged; Volume.ValueChanged -= Volume_ValueChanged;
Volume.Value = Math.Round(volume * 100); Volume.Value = Math.Round(volume * 100);
Volume.ValueChanged += Volume_ValueChanged; Volume.ValueChanged += Volume_ValueChanged;
if (muted) if (muted)
{ {
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip); var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
PopupIcon.Content = IconResourceLoader.Load(MutedIcon); PopupIcon.Content = IconResourceLoader.Load(MutedIcon);
ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); ButtonIcon.Content = IconResourceLoader.Load(MutedIcon);
} }
else else
{ {
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip); var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
PopupIcon.Content = LoadIcon(volume); PopupIcon.Content = LoadIcon(volume);
ButtonIcon.Content = LoadIcon(volume); ButtonIcon.Content = LoadIcon(volume);
} }

View file

@ -35,7 +35,9 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
Icon.Content = IconResourceLoader.Load(window?.Icon ?? application.Icon); Icon.Content = IconResourceLoader.Load(window?.Icon ?? application.Icon);
Text.Text = window?.Title ?? application.Name; Text.Text = window?.Title ?? application.Name;
Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty); Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty);
Button.ToolTip = window?.Title ?? application.Tooltip; var tooltip = window?.Title ?? application.Tooltip;
Button.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(Button, tooltip);
if (window != null) if (window != null)
{ {

View file

@ -113,6 +113,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
this.muted = muted; this.muted = muted;
Button.ToolTip = info; Button.ToolTip = info;
System.Windows.Automation.AutomationProperties.SetName(Button, info);
Text.Text = info; Text.Text = info;
Volume.ValueChanged -= Volume_ValueChanged; Volume.ValueChanged -= Volume_ValueChanged;
Volume.Value = Math.Round(volume * 100); Volume.Value = Math.Round(volume * 100);
@ -120,14 +121,18 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter
if (muted) if (muted)
{ {
var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); ButtonIcon.Content = IconResourceLoader.Load(MutedIcon);
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip);
PopupIcon.Content = IconResourceLoader.Load(MutedIcon); PopupIcon.Content = IconResourceLoader.Load(MutedIcon);
} }
else else
{ {
var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
ButtonIcon.Content = LoadIcon(volume); ButtonIcon.Content = LoadIcon(volume);
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip);
PopupIcon.Content = LoadIcon(volume); PopupIcon.Content = LoadIcon(volume);
} }
} }

View file

@ -44,6 +44,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
Button.MouseEnter += (o, args) => WindowPopup.IsOpen = WindowStackPanel.Children.Count > 0; Button.MouseEnter += (o, args) => WindowPopup.IsOpen = WindowStackPanel.Children.Count > 0;
Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = WindowPopup.IsMouseOver || ActiveBar.IsMouseOver)); Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = WindowPopup.IsMouseOver || ActiveBar.IsMouseOver));
Button.ToolTip = application.Tooltip; Button.ToolTip = application.Tooltip;
System.Windows.Automation.AutomationProperties.SetName(Button, application.Tooltip);
WindowPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(WindowPopup_PlacementCallback); WindowPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(WindowPopup_PlacementCallback);
WindowPopup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = IsMouseOver)); WindowPopup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = IsMouseOver));

View file

@ -132,19 +132,24 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
this.muted = muted; this.muted = muted;
Button.ToolTip = info; Button.ToolTip = info;
System.Windows.Automation.AutomationProperties.SetName(Button, info);
Volume.ValueChanged -= Volume_ValueChanged; Volume.ValueChanged -= Volume_ValueChanged;
Volume.Value = Math.Round(volume * 100); Volume.Value = Math.Round(volume * 100);
Volume.ValueChanged += Volume_ValueChanged; Volume.ValueChanged += Volume_ValueChanged;
if (muted) if (muted)
{ {
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip); var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
PopupIcon.Content = IconResourceLoader.Load(MutedIcon); PopupIcon.Content = IconResourceLoader.Load(MutedIcon);
ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); ButtonIcon.Content = IconResourceLoader.Load(MutedIcon);
} }
else else
{ {
MuteButton.ToolTip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip); var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip);
MuteButton.ToolTip = tooltip;
System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip);
PopupIcon.Content = LoadIcon(volume); PopupIcon.Content = LoadIcon(volume);
ButtonIcon.Content = LoadIcon(volume); ButtonIcon.Content = LoadIcon(volume);
} }