Finished first draft of multi-instance and multi-application layout / behaviour of taskbar.
This commit is contained in:
parent
2104f401ec
commit
e4508f0d49
5 changed files with 24 additions and 31 deletions
|
@ -181,25 +181,6 @@ namespace SafeExamBrowser.Core.Behaviour
|
|||
// TODO
|
||||
|
||||
taskbar.AddButton(browserButton);
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.AddButton(uiFactory.CreateApplicationButton(browserInfo));
|
||||
taskbar.SetPosition(500, 500);
|
||||
}
|
||||
|
||||
private void FinishInitialization()
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<Popup x:Name="InstancePopup" IsOpen="False" Placement="Top" PlacementTarget="{Binding ElementName=Button}" AllowsTransparency="True">
|
||||
<ScrollViewer x:Name="InstanceScrollViewer" VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer.Background>
|
||||
<SolidColorBrush Color="Black" Opacity="0.8"/>
|
||||
<SolidColorBrush Color="Black" Opacity="0.8" />
|
||||
</ScrollViewer.Background>
|
||||
<ScrollViewer.Resources>
|
||||
<s:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">5</s:Double>
|
||||
|
@ -19,10 +19,10 @@
|
|||
<StackPanel x:Name="InstanceStackPanel" />
|
||||
</ScrollViewer>
|
||||
</Popup>
|
||||
<Button x:Name="Button" BorderThickness="0" Click="Button_Click" Width="50">
|
||||
<Button x:Name="Button" Background="#00000000" BorderThickness="0" Click="Button_Click" Width="50">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="ButtonContent" Background="#00000000" Padding="5">
|
||||
<Border x:Name="ButtonContent" Background="{TemplateBinding Background}" Padding="5">
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
|
@ -36,5 +36,8 @@
|
|||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
</Button>
|
||||
<Grid Panel.ZIndex="10">
|
||||
<Rectangle x:Name="ActiveBar" Height="3" Width="40" VerticalAlignment="Bottom" Fill="LightSteelBlue" Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -14,6 +14,7 @@ using System.Windows.Controls;
|
|||
using SafeExamBrowser.Contracts.Configuration;
|
||||
using SafeExamBrowser.Contracts.UserInterface;
|
||||
using SafeExamBrowser.UserInterface.Utilities;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SafeExamBrowser.UserInterface.Controls
|
||||
{
|
||||
|
@ -39,20 +40,28 @@ namespace SafeExamBrowser.UserInterface.Controls
|
|||
instances.Add(instance);
|
||||
instanceButton.Click += (id) => OnClick?.Invoke(id);
|
||||
InstanceStackPanel.Children.Add(instanceButton);
|
||||
|
||||
ActiveBar.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public void UnregisterInstance(Guid id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
instances.Remove(instances.FirstOrDefault(i => i.Id == id));
|
||||
|
||||
if (!instances.Any())
|
||||
{
|
||||
ActiveBar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeApplicationButton()
|
||||
{
|
||||
Button.ToolTip = info.Tooltip;
|
||||
Button.MouseLeave += (o, args) => InstancePopup.IsOpen = InstancePopup.IsMouseOver;
|
||||
Button.Content = ApplicationIconResourceLoader.Load(info.IconResource);
|
||||
|
||||
Button.MouseLeave += (o, args) => InstancePopup.IsOpen = InstancePopup.IsMouseOver;
|
||||
InstancePopup.MouseLeave += (o, args) => InstancePopup.IsOpen = false;
|
||||
InstancePopup.Closed += (o, args) => ActiveBar.Width = 40;
|
||||
InstanceStackPanel.SizeChanged += (o, args) =>
|
||||
{
|
||||
if (instances.Count > 9)
|
||||
|
@ -71,6 +80,7 @@ namespace SafeExamBrowser.UserInterface.Controls
|
|||
else
|
||||
{
|
||||
InstancePopup.IsOpen = true;
|
||||
ActiveBar.Width = Double.NaN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ContentControl x:Name="Icon" />
|
||||
<TextBlock x:Name="Text" Foreground="White" Padding="5,0,5,0" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using SafeExamBrowser.Contracts.Configuration;
|
||||
using SafeExamBrowser.UserInterface.Utilities;
|
||||
|
||||
|
@ -34,13 +33,9 @@ namespace SafeExamBrowser.UserInterface.Controls
|
|||
|
||||
private void InitializeApplicationInstanceButton()
|
||||
{
|
||||
var panel = new StackPanel { Orientation = Orientation.Horizontal };
|
||||
|
||||
panel.Children.Add(ApplicationIconResourceLoader.Load(info.IconResource));
|
||||
panel.Children.Add(new TextBlock { Text = instance.Name, Foreground = Brushes.White, Padding = new Thickness(5, 0, 5, 0) });
|
||||
|
||||
Icon.Content = ApplicationIconResourceLoader.Load(info.IconResource);
|
||||
Text.Text = instance.Name;
|
||||
Button.ToolTip = $"{instance.Name} - {info.Tooltip}";
|
||||
Button.Content = panel;
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
|
|
Loading…
Reference in a new issue