Implemented visual indication for active applications in taskbar.
This commit is contained in:
		
							parent
							
								
									cd053e760e
								
							
						
					
					
						commit
						89401df6f6
					
				
					 4 changed files with 18 additions and 4 deletions
				
			
		| 
						 | 
					@ -24,5 +24,8 @@
 | 
				
			||||||
            </Border>
 | 
					            </Border>
 | 
				
			||||||
        </Popup>
 | 
					        </Popup>
 | 
				
			||||||
        <Button x:Name="Button" Background="{StaticResource BackgroundBrush}" Padding="4" Template="{StaticResource TaskbarButton}" Width="50" />
 | 
					        <Button x:Name="Button" Background="{StaticResource BackgroundBrush}" Padding="4" Template="{StaticResource TaskbarButton}" Width="50" />
 | 
				
			||||||
 | 
					        <Grid>
 | 
				
			||||||
 | 
					            <Rectangle x:Name="ActiveBar" Cursor="Hand" Height="2.5" Width="40" VerticalAlignment="Bottom" Fill="DodgerBlue" Visibility="Collapsed" />
 | 
				
			||||||
 | 
					        </Grid>
 | 
				
			||||||
    </Grid>
 | 
					    </Grid>
 | 
				
			||||||
</UserControl>
 | 
					</UserControl>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	internal partial class ApplicationControl : UserControl, IApplicationControl
 | 
						internal partial class ApplicationControl : UserControl, IApplicationControl
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private IApplication application;
 | 
							private readonly IApplication application;
 | 
				
			||||||
		private IApplicationWindow single;
 | 
							private IApplicationWindow single;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		internal ApplicationControl(IApplication application)
 | 
							internal ApplicationControl(IApplication application)
 | 
				
			||||||
| 
						 | 
					@ -38,22 +38,25 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			application.WindowsChanged += Application_WindowsChanged;
 | 
								application.WindowsChanged += Application_WindowsChanged;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								ActiveBar.MouseLeave += (o, args) => WindowPopup.IsOpen &= WindowPopup.IsMouseOver || Button.IsMouseOver;
 | 
				
			||||||
			Button.Click += Button_Click;
 | 
								Button.Click += Button_Click;
 | 
				
			||||||
			Button.Content = IconResourceLoader.Load(application.Icon);
 | 
								Button.Content = IconResourceLoader.Load(application.Icon);
 | 
				
			||||||
			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));
 | 
								Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = WindowPopup.IsMouseOver || ActiveBar.IsMouseOver));
 | 
				
			||||||
			Button.ToolTip = application.Tooltip;
 | 
								Button.ToolTip = 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));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			WindowPopup.Opened += (o, args) =>
 | 
								WindowPopup.Opened += (o, args) =>
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									ActiveBar.Width = double.NaN;
 | 
				
			||||||
				Background = Brushes.LightGray;
 | 
									Background = Brushes.LightGray;
 | 
				
			||||||
				Button.Background = Brushes.LightGray;
 | 
									Button.Background = Brushes.LightGray;
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			WindowPopup.Closed += (o, args) =>
 | 
								WindowPopup.Closed += (o, args) =>
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									ActiveBar.Width = 40;
 | 
				
			||||||
				Background = originalBrush;
 | 
									Background = originalBrush;
 | 
				
			||||||
				Button.Background = originalBrush;
 | 
									Button.Background = originalBrush;
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
| 
						 | 
					@ -88,6 +91,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Controls.Taskbar
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			var windows = application.GetWindows();
 | 
								var windows = application.GetWindows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								ActiveBar.Visibility = windows.Any() ? Visibility.Visible : Visibility.Collapsed;
 | 
				
			||||||
			WindowStackPanel.Children.Clear();
 | 
								WindowStackPanel.Children.Clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			foreach (var window in windows)
 | 
								foreach (var window in windows)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -24,5 +24,8 @@
 | 
				
			||||||
            </Border>
 | 
					            </Border>
 | 
				
			||||||
        </Popup>
 | 
					        </Popup>
 | 
				
			||||||
        <Button x:Name="Button" Background="{StaticResource BackgroundBrush}" Padding="4" Template="{StaticResource TaskbarButton}" Width="60" />
 | 
					        <Button x:Name="Button" Background="{StaticResource BackgroundBrush}" Padding="4" Template="{StaticResource TaskbarButton}" Width="60" />
 | 
				
			||||||
 | 
					        <Grid>
 | 
				
			||||||
 | 
					            <Rectangle x:Name="ActiveBar" Cursor="Hand" Height="2.5" Width="40" VerticalAlignment="Bottom" Fill="DodgerBlue" Visibility="Collapsed" />
 | 
				
			||||||
 | 
					        </Grid>
 | 
				
			||||||
    </Grid>
 | 
					    </Grid>
 | 
				
			||||||
</UserControl>
 | 
					</UserControl>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	internal partial class ApplicationControl : UserControl, IApplicationControl
 | 
						internal partial class ApplicationControl : UserControl, IApplicationControl
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private IApplication application;
 | 
							private readonly IApplication application;
 | 
				
			||||||
		private IApplicationWindow single;
 | 
							private IApplicationWindow single;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		internal ApplicationControl(IApplication application)
 | 
							internal ApplicationControl(IApplication application)
 | 
				
			||||||
| 
						 | 
					@ -38,22 +38,25 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			application.WindowsChanged += Application_WindowsChanged;
 | 
								application.WindowsChanged += Application_WindowsChanged;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								ActiveBar.MouseLeave += (o, args) => WindowPopup.IsOpen &= WindowPopup.IsMouseOver || Button.IsMouseOver;
 | 
				
			||||||
			Button.Click += Button_Click;
 | 
								Button.Click += Button_Click;
 | 
				
			||||||
			Button.Content = IconResourceLoader.Load(application.Icon);
 | 
								Button.Content = IconResourceLoader.Load(application.Icon);
 | 
				
			||||||
			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));
 | 
								Button.MouseLeave += (o, args) => Task.Delay(250).ContinueWith(_ => Dispatcher.Invoke(() => WindowPopup.IsOpen = WindowPopup.IsMouseOver || ActiveBar.IsMouseOver));
 | 
				
			||||||
			Button.ToolTip = application.Tooltip;
 | 
								Button.ToolTip = 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));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			WindowPopup.Opened += (o, args) =>
 | 
								WindowPopup.Opened += (o, args) =>
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									ActiveBar.Width = double.NaN;
 | 
				
			||||||
				Background = Brushes.LightGray;
 | 
									Background = Brushes.LightGray;
 | 
				
			||||||
				Button.Background = Brushes.LightGray;
 | 
									Button.Background = Brushes.LightGray;
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			WindowPopup.Closed += (o, args) =>
 | 
								WindowPopup.Closed += (o, args) =>
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									ActiveBar.Width = 40;
 | 
				
			||||||
				Background = originalBrush;
 | 
									Background = originalBrush;
 | 
				
			||||||
				Button.Background = originalBrush;
 | 
									Button.Background = originalBrush;
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
| 
						 | 
					@ -88,6 +91,7 @@ namespace SafeExamBrowser.UserInterface.Mobile.Controls.Taskbar
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			var windows = application.GetWindows();
 | 
								var windows = application.GetWindows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								ActiveBar.Visibility = windows.Any() ? Visibility.Visible : Visibility.Collapsed;
 | 
				
			||||||
			WindowStackPanel.Children.Clear();
 | 
								WindowStackPanel.Children.Clear();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			foreach (var window in windows)
 | 
								foreach (var window in windows)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue