SEBWIN-667: Fixed crash when third-party application has no title.
This commit is contained in:
		
							parent
							
								
									4aa856f98a
								
							
						
					
					
						commit
						65840f646e
					
				
					 20 changed files with 137 additions and 60 deletions
				
			
		|  | @ -7,6 +7,7 @@ | |||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.Applications.Contracts; | ||||
| using SafeExamBrowser.Core.Contracts.Resources.Icons; | ||||
|  | @ -16,8 +17,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter | |||
| { | ||||
| 	internal partial class ApplicationButton : UserControl | ||||
| 	{ | ||||
| 		private IApplication application; | ||||
| 		private IApplicationWindow window; | ||||
| 		private readonly IApplication application; | ||||
| 		private readonly IApplicationWindow window; | ||||
| 
 | ||||
| 		internal event EventHandler Clicked; | ||||
| 
 | ||||
|  | @ -32,14 +33,19 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter | |||
| 
 | ||||
| 		private void InitializeApplicationInstanceButton() | ||||
| 		{ | ||||
| 			var tooltip = window?.Title ?? application.Tooltip; | ||||
| 
 | ||||
| 			Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty); | ||||
| 			Button.ToolTip = tooltip; | ||||
| 			Icon.Content = IconResourceLoader.Load(window?.Icon ?? application.Icon); | ||||
| 			Text.Text = window?.Title ?? application.Name; | ||||
| 			Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty); | ||||
| 			var tooltip = window?.Title ?? application.Tooltip; | ||||
| 			Button.ToolTip = tooltip; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, tooltip); | ||||
| 
 | ||||
| 			if (window != null) | ||||
| 			if (tooltip != default) | ||||
| 			{ | ||||
| 				AutomationProperties.SetName(Button, string.Empty); | ||||
| 			} | ||||
| 
 | ||||
| 			if (window != default) | ||||
| 			{ | ||||
| 				window.IconChanged += Window_IconChanged; | ||||
| 				window.TitleChanged += Window_TitleChanged; | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using System.Windows.Controls.Primitives; | ||||
| using System.Windows.Media; | ||||
|  | @ -52,7 +53,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.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; | ||||
| 				} | ||||
|  | @ -140,27 +143,32 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter | |||
| 			this.muted = muted; | ||||
| 
 | ||||
| 			Button.ToolTip = info; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, info); | ||||
| 			Text.Text = info; | ||||
| 			Volume.ValueChanged -= Volume_ValueChanged; | ||||
| 			Volume.Value = Math.Round(volume * 100); | ||||
| 			Volume.ValueChanged += Volume_ValueChanged; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, info); | ||||
| 
 | ||||
| 			if (muted) | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 				PopupIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				ButtonIcon.Content = LoadIcon(volume); | ||||
| 				PopupIcon.Content = LoadIcon(volume); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| 
 | ||||
| using System; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.SystemComponents.Contracts.Keyboard; | ||||
| 
 | ||||
|  | @ -43,7 +44,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter | |||
| 			CultureCodeTextBlock.Text = layout.CultureCode; | ||||
| 			CultureNameTextBlock.Text = layout.CultureName; | ||||
| 			LayoutNameTextBlock.Text = layout.LayoutName; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
|  | @ -19,8 +18,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter | |||
| { | ||||
| 	internal partial class KeyboardLayoutControl : UserControl, ISystemControl | ||||
| 	{ | ||||
| 		private IKeyboard keyboard; | ||||
| 		private IText text; | ||||
| 		private readonly IKeyboard keyboard; | ||||
| 		private readonly IText text; | ||||
| 
 | ||||
| 		internal KeyboardLayoutControl(IKeyboard keyboard, IText text) | ||||
| 		{ | ||||
|  | @ -54,7 +53,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.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; | ||||
| 				} | ||||
|  | @ -124,6 +125,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter | |||
| 
 | ||||
| 			Text.Text = layout.CultureName; | ||||
| 			Button.ToolTip = tooltip; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, tooltip); | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.ActionCenter | |||
| { | ||||
| 	internal partial class NotificationButton : UserControl, INotificationControl | ||||
| 	{ | ||||
| 		private INotification notification; | ||||
| 		private readonly INotification notification; | ||||
| 
 | ||||
| 		internal NotificationButton(INotification notification) | ||||
| 		{ | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| using System.Linq; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using System.Windows.Controls.Primitives; | ||||
| using System.Windows.Media; | ||||
|  | @ -44,10 +45,14 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 			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.ToolTip = application.Tooltip; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, application.Tooltip); | ||||
| 			WindowPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(WindowPopup_PlacementCallback); | ||||
| 			WindowPopup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = IsMouseOver)); | ||||
| 
 | ||||
| 			if (application.Tooltip != default) | ||||
| 			{ | ||||
| 				AutomationProperties.SetName(Button, application.Tooltip); | ||||
| 			} | ||||
| 
 | ||||
| 			WindowPopup.Opened += (o, args) => | ||||
| 			{ | ||||
| 				ActiveBar.Width = double.NaN; | ||||
|  | @ -106,7 +111,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				single = default(IApplicationWindow); | ||||
| 				single = default; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using System.Windows.Controls.Primitives; | ||||
| using System.Windows.Media; | ||||
|  | @ -51,7 +52,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 			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; | ||||
| 				} | ||||
|  | @ -155,26 +158,31 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 			this.muted = muted; | ||||
| 
 | ||||
| 			Button.ToolTip = info; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, info); | ||||
| 			Volume.ValueChanged -= Volume_ValueChanged; | ||||
| 			Volume.Value = Math.Round(volume * 100); | ||||
| 			Volume.ValueChanged += Volume_ValueChanged; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, info); | ||||
| 
 | ||||
| 			if (muted) | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				PopupIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 				ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				PopupIcon.Content = LoadIcon(volume); | ||||
| 				ButtonIcon.Content = LoadIcon(volume); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| 
 | ||||
| using System; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.SystemComponents.Contracts.Keyboard; | ||||
| 
 | ||||
|  | @ -43,7 +44,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 			CultureCodeTextBlock.Text = layout.CultureCode; | ||||
| 			CultureNameTextBlock.Text = layout.CultureName; | ||||
| 			LayoutNameTextBlock.Text = layout.LayoutName; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -22,8 +22,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| { | ||||
| 	internal partial class KeyboardLayoutControl : UserControl, ISystemControl | ||||
| 	{ | ||||
| 		private IKeyboard keyboard; | ||||
| 		private IText text; | ||||
| 		private readonly IKeyboard keyboard; | ||||
| 		private readonly IText text; | ||||
| 
 | ||||
| 		internal KeyboardLayoutControl(IKeyboard keyboard, IText text) | ||||
| 		{ | ||||
|  | @ -57,7 +57,9 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 			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; | ||||
| 				} | ||||
|  | @ -144,6 +146,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 
 | ||||
| 			LayoutCultureCode.Text = layout.CultureCode; | ||||
| 			Button.ToolTip = tooltip; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, tooltip); | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ | |||
|  */ | ||||
| 
 | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.Core.Contracts.Notifications; | ||||
| using SafeExamBrowser.UserInterface.Contracts.Shell; | ||||
|  | @ -16,7 +17,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| { | ||||
| 	internal partial class NotificationButton : UserControl, INotificationControl | ||||
| 	{ | ||||
| 		private INotification notification; | ||||
| 		private readonly INotification notification; | ||||
| 
 | ||||
| 		internal NotificationButton(INotification notification) | ||||
| 		{ | ||||
|  | @ -41,7 +42,8 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar | |||
| 		{ | ||||
| 			IconButton.ToolTip = notification.Tooltip; | ||||
| 			IconButton.Content = IconResourceLoader.Load(notification.IconResource); | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(this, notification.Tooltip); | ||||
| 
 | ||||
| 			AutomationProperties.SetName(this, notification.Tooltip); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ | |||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.Applications.Contracts; | ||||
| using SafeExamBrowser.Core.Contracts.Resources.Icons; | ||||
|  | @ -16,8 +17,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter | |||
| { | ||||
| 	internal partial class ApplicationButton : UserControl | ||||
| 	{ | ||||
| 		private IApplication application; | ||||
| 		private IApplicationWindow window; | ||||
| 		private readonly IApplication application; | ||||
| 		private readonly IApplicationWindow window; | ||||
| 
 | ||||
| 		internal event EventHandler Clicked; | ||||
| 
 | ||||
|  | @ -32,14 +33,19 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter | |||
| 
 | ||||
| 		private void InitializeApplicationInstanceButton() | ||||
| 		{ | ||||
| 			var tooltip = window?.Title ?? application.Tooltip; | ||||
| 
 | ||||
| 			Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty); | ||||
| 			Button.ToolTip = tooltip; | ||||
| 			Icon.Content = IconResourceLoader.Load(window?.Icon ?? application.Icon); | ||||
| 			Text.Text = window?.Title ?? application.Name; | ||||
| 			Button.Click += (o, args) => Clicked?.Invoke(this, EventArgs.Empty); | ||||
| 			var tooltip = window?.Title ?? application.Tooltip; | ||||
| 			Button.ToolTip = tooltip; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, tooltip); | ||||
| 
 | ||||
| 			if (window != null) | ||||
| 			if (tooltip != default) | ||||
| 			{ | ||||
| 				AutomationProperties.SetName(Button, tooltip); | ||||
| 			} | ||||
| 
 | ||||
| 			if (window != default) | ||||
| 			{ | ||||
| 				window.IconChanged += Window_IconChanged; | ||||
| 				window.TitleChanged += Window_TitleChanged; | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using System.Windows.Controls.Primitives; | ||||
| using System.Windows.Media; | ||||
|  | @ -52,7 +53,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; | ||||
| 				} | ||||
|  | @ -139,27 +142,32 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter | |||
| 			this.muted = muted; | ||||
| 
 | ||||
| 			Button.ToolTip = info; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, info); | ||||
| 			Text.Text = info; | ||||
| 			Volume.ValueChanged -= Volume_ValueChanged; | ||||
| 			Volume.Value = Math.Round(volume * 100); | ||||
| 			Volume.ValueChanged += Volume_ValueChanged; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, info); | ||||
| 
 | ||||
| 			if (muted) | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 				PopupIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				ButtonIcon.Content = LoadIcon(volume); | ||||
| 				PopupIcon.Content = LoadIcon(volume); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| 
 | ||||
| using System; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.SystemComponents.Contracts.Keyboard; | ||||
| 
 | ||||
|  | @ -43,7 +44,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter | |||
| 			CultureCodeTextBlock.Text = layout.CultureCode; | ||||
| 			CultureNameTextBlock.Text = layout.CultureName; | ||||
| 			LayoutNameTextBlock.Text = layout.LayoutName; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ | |||
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
|  */ | ||||
| 
 | ||||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
|  | @ -19,8 +18,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter | |||
| { | ||||
| 	internal partial class KeyboardLayoutControl : UserControl, ISystemControl | ||||
| 	{ | ||||
| 		private IKeyboard keyboard; | ||||
| 		private IText text; | ||||
| 		private readonly IKeyboard keyboard; | ||||
| 		private readonly IText text; | ||||
| 
 | ||||
| 		internal KeyboardLayoutControl(IKeyboard keyboard, IText text) | ||||
| 		{ | ||||
|  | @ -54,7 +53,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; | ||||
| 				} | ||||
|  | @ -124,6 +125,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter | |||
| 
 | ||||
| 			Text.Text = layout.CultureName; | ||||
| 			Button.ToolTip = tooltip; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, tooltip); | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.ActionCenter | |||
| { | ||||
| 	internal partial class NotificationButton : UserControl, INotificationControl | ||||
| 	{ | ||||
| 		private INotification notification; | ||||
| 		private readonly INotification notification; | ||||
| 
 | ||||
| 		internal NotificationButton(INotification notification) | ||||
| 		{ | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| using System.Linq; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using System.Windows.Controls.Primitives; | ||||
| using System.Windows.Media; | ||||
|  | @ -44,10 +45,14 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 			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.ToolTip = application.Tooltip; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, application.Tooltip); | ||||
| 			WindowPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(WindowPopup_PlacementCallback); | ||||
| 			WindowPopup.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = IsMouseOver)); | ||||
| 
 | ||||
| 			if (application.Tooltip != default) | ||||
| 			{ | ||||
| 				AutomationProperties.SetName(Button, application.Tooltip); | ||||
| 			} | ||||
| 
 | ||||
| 			WindowPopup.Opened += (o, args) => | ||||
| 			{ | ||||
| 				ActiveBar.Width = double.NaN; | ||||
|  | @ -106,7 +111,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				single = default(IApplicationWindow); | ||||
| 				single = default; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using System.Windows.Controls.Primitives; | ||||
| using System.Windows.Media; | ||||
|  | @ -51,7 +52,9 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 			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; | ||||
| 				} | ||||
|  | @ -155,26 +158,31 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 			this.muted = muted; | ||||
| 
 | ||||
| 			Button.ToolTip = info; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, info); | ||||
| 			Volume.ValueChanged -= Volume_ValueChanged; | ||||
| 			Volume.Value = Math.Round(volume * 100); | ||||
| 			Volume.ValueChanged += Volume_ValueChanged; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, info); | ||||
| 
 | ||||
| 			if (muted) | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceUnmuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				PopupIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 				ButtonIcon.Content = IconResourceLoader.Load(MutedIcon); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				var tooltip = text.Get(TextKey.SystemControl_AudioDeviceMuteTooltip); | ||||
| 
 | ||||
| 				MuteButton.ToolTip = tooltip; | ||||
| 				System.Windows.Automation.AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 				PopupIcon.Content = LoadIcon(volume); | ||||
| 				ButtonIcon.Content = LoadIcon(volume); | ||||
| 
 | ||||
| 				AutomationProperties.SetName(MuteButton, tooltip); | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ | |||
| 
 | ||||
| using System; | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.SystemComponents.Contracts.Keyboard; | ||||
| 
 | ||||
|  | @ -43,7 +44,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 			CultureCodeTextBlock.Text = layout.CultureCode; | ||||
| 			CultureNameTextBlock.Text = layout.CultureName; | ||||
| 			LayoutNameTextBlock.Text = layout.LayoutName; | ||||
| 			System.Windows.Automation.AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, layout.CultureName); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
|  | @ -22,8 +22,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| { | ||||
| 	internal partial class KeyboardLayoutControl : UserControl, ISystemControl | ||||
| 	{ | ||||
| 		private IKeyboard keyboard; | ||||
| 		private IText text; | ||||
| 		private readonly IKeyboard keyboard; | ||||
| 		private readonly IText text; | ||||
| 
 | ||||
| 		internal KeyboardLayoutControl(IKeyboard keyboard, IText text) | ||||
| 		{ | ||||
|  | @ -57,7 +57,9 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 			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; | ||||
| 				} | ||||
|  | @ -144,6 +146,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 
 | ||||
| 			LayoutCultureCode.Text = layout.CultureCode; | ||||
| 			Button.ToolTip = tooltip; | ||||
| 
 | ||||
| 			AutomationProperties.SetName(Button, tooltip); | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,6 +7,7 @@ | |||
|  */ | ||||
| 
 | ||||
| using System.Windows; | ||||
| using System.Windows.Automation; | ||||
| using System.Windows.Controls; | ||||
| using SafeExamBrowser.Core.Contracts.Notifications; | ||||
| using SafeExamBrowser.UserInterface.Contracts.Shell; | ||||
|  | @ -16,7 +17,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| { | ||||
| 	internal partial class NotificationButton : UserControl, INotificationControl | ||||
| 	{ | ||||
| 		private INotification notification; | ||||
| 		private readonly INotification notification; | ||||
| 
 | ||||
| 		internal NotificationButton(INotification notification) | ||||
| 		{ | ||||
|  | @ -41,6 +42,8 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar | |||
| 		{ | ||||
| 			IconButton.ToolTip = notification.Tooltip; | ||||
| 			IconButton.Content = IconResourceLoader.Load(notification.IconResource); | ||||
| 
 | ||||
| 			AutomationProperties.SetName(this, notification.Tooltip); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Damian Büchel
						Damian Büchel