SEBWIN-219: Implemented draft of runtime window.
This commit is contained in:
parent
1e8eb858de
commit
87f4ad8bf2
5 changed files with 115 additions and 4 deletions
|
@ -63,10 +63,9 @@ namespace SafeExamBrowser.Runtime
|
|||
|
||||
if (success)
|
||||
{
|
||||
// TODO: Probably needs new window to display status of running application...
|
||||
//MainWindow = instances.SplashScreen;
|
||||
//MainWindow.Closing += MainWindow_Closing;
|
||||
//MainWindow.Show();
|
||||
MainWindow = instances.RuntimeWindow;
|
||||
MainWindow.Closing += MainWindow_Closing;
|
||||
MainWindow.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace SafeExamBrowser.Runtime
|
|||
|
||||
internal IRuntimeController RuntimeController { get; private set; }
|
||||
internal Queue<IOperation> StartupOperations { get; private set; }
|
||||
internal RuntimeWindow RuntimeWindow { get; private set; }
|
||||
|
||||
internal void BuildObjectGraph()
|
||||
{
|
||||
|
@ -56,6 +57,9 @@ namespace SafeExamBrowser.Runtime
|
|||
var startupController = new StartupController(logger, runtimeInfo, systemInfo, text, uiFactory);
|
||||
|
||||
RuntimeController = new RuntimeController(serviceProxy, new ModuleLogger(logger, typeof(RuntimeController)), settingsRepository, shutdownController, startupController);
|
||||
RuntimeWindow = new RuntimeWindow(new DefaultLogFormatter(), runtimeInfo);
|
||||
|
||||
logger.Subscribe(RuntimeWindow);
|
||||
|
||||
StartupOperations = new Queue<IOperation>();
|
||||
StartupOperations.Enqueue(new I18nOperation(logger, text));
|
||||
|
|
56
SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml
Normal file
56
SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml
Normal file
|
@ -0,0 +1,56 @@
|
|||
<Window x:Class="SafeExamBrowser.UserInterface.Classic.RuntimeWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Classic"
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
mc:Ignorable="d" Background="White" Foreground="White" Height="500" Width="750" WindowStyle="None" WindowStartupLocation="CenterScreen"
|
||||
Icon="./Images/SafeExamBrowser.ico" ResizeMode="NoResize" Title="RuntimeWindow" Topmost="True">
|
||||
<Grid>
|
||||
<Border Panel.ZIndex="10" BorderBrush="DodgerBlue" BorderThickness="5">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="10" />
|
||||
</Border.Effect>
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Style.Triggers>
|
||||
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation AutoReverse="True" Storyboard.TargetProperty="Opacity" From="1.0" To="0.2" Duration="0:0:2.5" RepeatBehavior="Forever" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
</Border>
|
||||
<Grid Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="2*" />
|
||||
<RowDefinition Height="25" />
|
||||
<RowDefinition Height="3*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="350" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Grid.Column="0" Grid.ColumnSpan="2" Margin="-25,0,0,0" Source="pack://application:,,,/SafeExamBrowser.UserInterface.Classic;component/Images/SplashScreen.png" />
|
||||
<TextBlock x:Name="InfoTextBlock" Grid.Column="1" Foreground="Gray" Margin="10,75,175,10" TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<!--<ProgressBar x:Name="ProgressBar" Grid.Row="1" IsIndeterminate="True" BorderThickness="0" />-->
|
||||
<TextBlock x:Name="StatusTextBlock" Grid.Row="1" Text="Application is running..." FontSize="12" FontWeight="Bold" Foreground="Black" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
<Border Grid.Row="2" BorderBrush="DodgerBlue" BorderThickness="0,0.5,0,0">
|
||||
<ScrollViewer x:Name="LogScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,10,0,0">
|
||||
<ScrollViewer.Resources>
|
||||
<s:Double x:Key="{x:Static SystemParameters.HorizontalScrollBarHeightKey}">5</s:Double>
|
||||
<s:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">5</s:Double>
|
||||
</ScrollViewer.Resources>
|
||||
<TextBox x:Name="LogTextBlock" Background="Transparent" BorderThickness="0" FontFamily="Courier New" Foreground="Black" IsReadOnly="True" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
45
SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml.cs
Normal file
45
SafeExamBrowser.UserInterface.Classic/RuntimeWindow.xaml.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2018 ETH Zürich, Educational Development and Technology (LET)
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using SafeExamBrowser.Contracts.Configuration;
|
||||
using SafeExamBrowser.Contracts.Logging;
|
||||
|
||||
namespace SafeExamBrowser.UserInterface.Classic
|
||||
{
|
||||
public partial class RuntimeWindow : Window, ILogObserver
|
||||
{
|
||||
private ILogContentFormatter formatter;
|
||||
private IRuntimeInfo runtimeInfo;
|
||||
|
||||
public RuntimeWindow(ILogContentFormatter formatter, IRuntimeInfo runtimeInfo)
|
||||
{
|
||||
this.formatter = formatter;
|
||||
this.runtimeInfo = runtimeInfo;
|
||||
|
||||
InitializeComponent();
|
||||
InitializeRuntimeWindow();
|
||||
}
|
||||
|
||||
public void Notify(ILogContent content)
|
||||
{
|
||||
LogTextBlock.Text += formatter.Format(content) + Environment.NewLine;
|
||||
LogScrollViewer.ScrollToEnd();
|
||||
}
|
||||
|
||||
private void InitializeRuntimeWindow()
|
||||
{
|
||||
InfoTextBlock.Inlines.Add(new Run($"Version {runtimeInfo.ProgramVersion}") { FontStyle = FontStyles.Italic });
|
||||
InfoTextBlock.Inlines.Add(new LineBreak());
|
||||
InfoTextBlock.Inlines.Add(new LineBreak());
|
||||
InfoTextBlock.Inlines.Add(new Run(runtimeInfo.ProgramCopyright) { FontSize = 10 });
|
||||
}
|
||||
}
|
||||
}
|
|
@ -105,6 +105,9 @@
|
|||
<Compile Include="LogWindow.xaml.cs">
|
||||
<DependentUpon>LogWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="RuntimeWindow.xaml.cs">
|
||||
<DependentUpon>RuntimeWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SplashScreen.xaml.cs">
|
||||
<DependentUpon>SplashScreen.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -219,6 +222,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="RuntimeWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="SplashScreen.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
Loading…
Reference in a new issue