Restore SEBPatch
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<UserControl x:Class="SafeExamBrowser.UserInterface.Mobile.Controls.Browser.DownloadItemControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:SafeExamBrowser.UserInterface.Mobile.Controls.Browser"
|
||||
mc:Ignorable="d" d:DesignHeight="50" d:DesignWidth="200">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ContentControl Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Panel.ZIndex="2" Name="Icon" Margin="10" Width="25" />
|
||||
<ProgressBar Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" Grid.ColumnSpan="2" Panel.ZIndex="1" Name="Progress" BorderThickness="0" />
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" Panel.ZIndex="2" Name="ItemName" FontWeight="Bold" Margin="0,10,10,0" />
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Panel.ZIndex="2" Name="Status" FontStyle="Italic" Margin="0,0,10,10" />
|
||||
</Grid>
|
||||
</UserControl>
|
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* 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.IO;
|
||||
using System.Windows.Controls;
|
||||
using SafeExamBrowser.I18n.Contracts;
|
||||
using SafeExamBrowser.UserInterface.Contracts.Browser.Data;
|
||||
using SafeExamBrowser.UserInterface.Shared.Utilities;
|
||||
|
||||
namespace SafeExamBrowser.UserInterface.Mobile.Controls.Browser
|
||||
{
|
||||
public partial class DownloadItemControl : UserControl
|
||||
{
|
||||
private IText text;
|
||||
|
||||
public Guid Id { get; }
|
||||
|
||||
public DownloadItemControl(Guid id, IText text)
|
||||
{
|
||||
this.Id = id;
|
||||
this.text = text;
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void Update(DownloadItemState state)
|
||||
{
|
||||
ItemName.Text = Uri.TryCreate(state.Url, UriKind.Absolute, out var uri) ? Path.GetFileName(uri.AbsolutePath) : state.Url;
|
||||
Progress.Value = state.Completion * 100;
|
||||
Status.Text = $"{text.Get(TextKey.BrowserWindow_Downloading)} ({state.Completion * 100}%)";
|
||||
|
||||
if (File.Exists(state.FullPath))
|
||||
{
|
||||
ItemName.Text = Path.GetFileName(state.FullPath);
|
||||
Icon.Content = new Image { Source = IconLoader.LoadIconFor(new FileInfo(state.FullPath)) };
|
||||
}
|
||||
|
||||
if (state.IsCancelled)
|
||||
{
|
||||
Progress.Visibility = System.Windows.Visibility.Collapsed;
|
||||
Status.Text = text.Get(TextKey.BrowserWindow_DownloadCancelled);
|
||||
}
|
||||
else if (state.IsComplete)
|
||||
{
|
||||
Progress.Visibility = System.Windows.Visibility.Collapsed;
|
||||
Status.Text = text.Get(TextKey.BrowserWindow_DownloadComplete);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user