2017-07-07 15:46:32 +02:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2017 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.Windows;
|
2017-07-10 15:47:12 +02:00
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using SafeExamBrowser.Contracts.Configuration;
|
2017-07-07 15:46:32 +02:00
|
|
|
|
using SafeExamBrowser.Contracts.Logging;
|
|
|
|
|
using SafeExamBrowser.Contracts.UserInterface;
|
2017-07-10 15:47:12 +02:00
|
|
|
|
using SafeExamBrowser.UserInterface.ViewModels;
|
2017-07-07 15:46:32 +02:00
|
|
|
|
|
|
|
|
|
namespace SafeExamBrowser.UserInterface
|
|
|
|
|
{
|
|
|
|
|
public partial class SplashScreen : Window, ISplashScreen
|
|
|
|
|
{
|
2017-07-10 15:47:12 +02:00
|
|
|
|
private SplashScreenViewModel model = new SplashScreenViewModel();
|
|
|
|
|
|
|
|
|
|
public SplashScreen(ISettings settings)
|
2017-07-07 15:46:32 +02:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2017-07-10 15:47:12 +02:00
|
|
|
|
|
|
|
|
|
StatusTextBlock.DataContext = model;
|
|
|
|
|
ProgressBar.DataContext = model;
|
|
|
|
|
|
|
|
|
|
InfoTextBlock.Inlines.Add(new Run($"Version {settings.ProgramVersion}") { FontStyle = FontStyles.Italic });
|
|
|
|
|
InfoTextBlock.Inlines.Add(new LineBreak());
|
|
|
|
|
InfoTextBlock.Inlines.Add(new LineBreak());
|
|
|
|
|
InfoTextBlock.Inlines.Add(new Run(settings.CopyrightInfo) { FontSize = 10 });
|
2017-07-07 15:46:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Notify(ILogContent content)
|
|
|
|
|
{
|
2017-07-10 15:47:12 +02:00
|
|
|
|
if (content is ILogMessage)
|
|
|
|
|
{
|
|
|
|
|
model.Status = (content as ILogMessage).Message;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetMaxProgress(int max)
|
|
|
|
|
{
|
|
|
|
|
model.MaxProgress = max;
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-12 15:36:30 +02:00
|
|
|
|
public void UpdateProgress(int amount = 1)
|
2017-07-10 15:47:12 +02:00
|
|
|
|
{
|
2017-07-12 15:36:30 +02:00
|
|
|
|
model.CurrentProgress += amount;
|
2017-07-07 15:46:32 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|