Router - Added reload

Workshop - Added image management to existing entries
Workshop - Fixed pagination in layouts page
This commit is contained in:
RobertBeekman authored and Robert committed 2024-01-28 22:43:35 +01:00
1 parent 19082481c3
commit 78b96deeab
25 files changed
+328 -100

No files matched your search

@@ -23,6 +23,11 @@
<ScrollViewer Grid.Row="1" Margin="0 20 0 0">
<ItemsControl ItemsSource="{CompiledBinding Images}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<ContentControl Content="{CompiledBinding}" Margin="0 0 5 0" Width="300"></ContentControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
@@ -16,7 +16,6 @@ namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps;
public class ImagesStepViewModel : SubmissionViewModel
{
private const long MAX_FILE_SIZE = 10 * 1024 * 1024; // 10 MB
private readonly IWindowService _windowService;
private readonly Func<ImageUploadRequest, ImageSubmissionViewModel> _getImageSubmissionViewModel;
private readonly SourceList<ImageUploadRequest> _stateImages;
@@ -66,7 +65,7 @@ public class ImagesStepViewModel : SubmissionViewModel
continue;
FileStream stream = new(path, FileMode.Open, FileAccess.Read);
if (stream.Length > MAX_FILE_SIZE)
if (stream.Length > ImageUploadRequest.MAX_FILE_SIZE)
{
await _windowService.ShowConfirmContentDialog("File too big", $"File {path} exceeds maximum file size of 10 MB", "Skip file", null);
await stream.DisposeAsync();
@@ -7,7 +7,7 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Layout.LayoutSelectionStepView"
x:DataType="layout:LayoutSelectionStepViewModel">
<Grid RowDefinitions="Auto,*">
<Grid RowDefinitions="Auto,*, *">
<StackPanel>
<StackPanel.Styles>
<Styles>
@@ -145,7 +145,7 @@ public partial class LayoutSelectionStepViewModel : SubmissionViewModel
return true;
}
private void SetDeviceImages()
private async Task SetDeviceImages()
{
if (Layout == null)
return;
@@ -153,15 +153,15 @@ public partial class LayoutSelectionStepViewModel : SubmissionViewModel
MemoryStream deviceWithoutLeds = new();
MemoryStream deviceWithLeds = new();
using (RenderTargetBitmap image = Layout.RenderLayout(false))
using (RenderTargetBitmap image = Layout.RenderLayout(false, 4))
{
image.Save(deviceWithoutLeds);
await Task.Run(() => image.Save(deviceWithoutLeds));
deviceWithoutLeds.Seek(0, SeekOrigin.Begin);
}
using (RenderTargetBitmap image = Layout.RenderLayout(true))
using (RenderTargetBitmap image = Layout.RenderLayout(true, 4))
{
image.Save(deviceWithLeds);
await Task.Run(() => image.Save(deviceWithLeds));
deviceWithLeds.Seek(0, SeekOrigin.Begin);
}