diff --git a/src/Artemis.UI.Shared/Styles/NumberBox.axaml b/src/Artemis.UI.Shared/Styles/NumberBox.axaml
index f4978d15c..6b4caedb7 100644
--- a/src/Artemis.UI.Shared/Styles/NumberBox.axaml
+++ b/src/Artemis.UI.Shared/Styles/NumberBox.axaml
@@ -27,22 +27,7 @@
-
-
-
-
-
-
diff --git a/src/Artemis.UI.Shared/Styles/TextBox.axaml b/src/Artemis.UI.Shared/Styles/TextBox.axaml
index da7c28175..6509a36f1 100644
--- a/src/Artemis.UI.Shared/Styles/TextBox.axaml
+++ b/src/Artemis.UI.Shared/Styles/TextBox.axaml
@@ -5,7 +5,21 @@
-
+ asdasdas asd
+asdasd
+asd
+asd
+asd
+as
+fdsfsdf
+sdg
+sdg
+sdg
+
+ asdasdas asd
+asdasd
+asd
+as
-
+
diff --git a/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogView.axaml b/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogView.axaml
new file mode 100644
index 000000000..b1a2ea2e6
--- /dev/null
+++ b/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogView.axaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogView.axaml.cs b/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogView.axaml.cs
new file mode 100644
index 000000000..5c47dd4c4
--- /dev/null
+++ b/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogView.axaml.cs
@@ -0,0 +1,13 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace Artemis.UI.Screens.Workshop.Image;
+
+public partial class ImagePropertiesDialogView : UserControl
+{
+ public ImagePropertiesDialogView()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogViewModel.cs b/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogViewModel.cs
new file mode 100644
index 000000000..476feed1d
--- /dev/null
+++ b/src/Artemis.UI/Screens/Workshop/Image/ImagePropertiesDialogViewModel.cs
@@ -0,0 +1,42 @@
+using System.Reactive;
+using Artemis.UI.Shared;
+using Artemis.WebClient.Workshop.Handlers.UploadHandlers;
+using FluentAvalonia.UI.Controls;
+using PropertyChanged.SourceGenerator;
+using ReactiveUI;
+using ReactiveUI.Validation.Extensions;
+
+namespace Artemis.UI.Screens.Workshop.Image;
+
+public partial class ImagePropertiesDialogViewModel : ContentDialogViewModelBase
+{
+ private readonly ImageUploadRequest _image;
+ [Notify] private string? _name;
+ [Notify] private string? _description;
+
+ public ImagePropertiesDialogViewModel(ImageUploadRequest image)
+ {
+ _image = image;
+ _name = image.Name;
+ _description = image.Description;
+
+ Confirm = ReactiveCommand.Create(ExecuteConfirm, ValidationContext.Valid);
+
+ this.ValidationRule(vm => vm.Name, input => !string.IsNullOrWhiteSpace(input), "Name is required");
+ this.ValidationRule(vm => vm.Name, input => input?.Length <= 50, "Name can be a maximum of 50 characters");
+ this.ValidationRule(vm => vm.Description, input => input?.Length <= 150, "Description can be a maximum of 150 characters");
+ }
+
+ public ReactiveCommand Confirm { get; }
+
+ private void ExecuteConfirm()
+ {
+ if (string.IsNullOrWhiteSpace(Name))
+ return;
+
+ _image.Name = Name;
+ _image.Description = string.IsNullOrWhiteSpace(Description) ? null : Description;
+
+ ContentDialog?.Hide(ContentDialogResult.Primary);
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionView.axaml b/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionView.axaml
index c6b6db1d5..8a880f46f 100644
--- a/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionView.axaml
+++ b/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionView.axaml
@@ -28,9 +28,9 @@
-
+
diff --git a/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionViewModel.cs b/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionViewModel.cs
index c2928781a..1b3c15962 100644
--- a/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionViewModel.cs
+++ b/src/Artemis.UI/Screens/Workshop/Image/ImageSubmissionViewModel.cs
@@ -1,7 +1,10 @@
using System.IO;
using System.Reactive.Disposables;
+using System.Threading.Tasks;
using System.Windows.Input;
using Artemis.UI.Shared;
+using Artemis.UI.Shared.Services;
+using Artemis.UI.Shared.Services.Builders;
using Artemis.WebClient.Workshop.Handlers.UploadHandlers;
using Avalonia.Media.Imaging;
using Avalonia.Threading;
@@ -13,6 +16,8 @@ namespace Artemis.UI.Screens.Workshop.Image;
public partial class ImageSubmissionViewModel : ValidatableViewModelBase
{
+ private readonly ImageUploadRequest _image;
+ private readonly IWindowService _windowService;
[Notify(Setter.Private)] private Bitmap? _bitmap;
[Notify(Setter.Private)] private string? _imageDimensions;
[Notify(Setter.Private)] private long _fileSize;
@@ -20,25 +25,35 @@ public partial class ImageSubmissionViewModel : ValidatableViewModelBase
[Notify] private string? _description;
[Notify] private ICommand? _remove;
- public ImageSubmissionViewModel(ImageUploadRequest image)
+ public ImageSubmissionViewModel(ImageUploadRequest image, IWindowService windowService)
{
+ _image = image;
+ _windowService = windowService;
+
this.WhenActivated(d =>
{
Dispatcher.UIThread.Invoke(() =>
{
- image.File.Seek(0, SeekOrigin.Begin);
- Bitmap = new Bitmap(image.File);
- FileSize = image.File.Length;
+ _image.File.Seek(0, SeekOrigin.Begin);
+ Bitmap = new Bitmap(_image.File);
+ FileSize = _image.File.Length;
ImageDimensions = Bitmap.Size.Width + "x" + Bitmap.Size.Height;
- Name = image.Name;
- Description = image.Description;
+ Name = _image.Name;
+ Description = _image.Description;
Bitmap.DisposeWith(d);
}, DispatcherPriority.Background);
});
-
- this.ValidationRule(vm => vm.Name, input => !string.IsNullOrWhiteSpace(input), "Name is required");
- this.ValidationRule(vm => vm.Name, input => input?.Length <= 50, "Name can be a maximum of 50 characters");
- this.ValidationRule(vm => vm.Description, input => input?.Length <= 150, "Description can be a maximum of 150 characters");
+ }
+
+ public async Task Edit()
+ {
+ await _windowService.CreateContentDialog()
+ .WithTitle("Edit image properties")
+ .WithViewModel(out ImagePropertiesDialogViewModel vm, _image)
+ .HavingPrimaryButton(b => b.WithText("Confirm").WithCommand(vm.Confirm))
+ .WithCloseButtonText("Cancel")
+ .WithDefaultButton(ContentDialogButton.Primary)
+ .ShowAsync();
}
}
\ No newline at end of file
diff --git a/src/Artemis.WebClient.Workshop/Services/AuthenticationService.cs b/src/Artemis.WebClient.Workshop/Services/AuthenticationService.cs
index db90979b5..d3fd43ac6 100644
--- a/src/Artemis.WebClient.Workshop/Services/AuthenticationService.cs
+++ b/src/Artemis.WebClient.Workshop/Services/AuthenticationService.cs
@@ -185,7 +185,7 @@ internal class AuthenticationService : CorePropertyChanged, IAuthenticationServi
return;
// Start a HTTP listener, this port could be in use but chances are very slim
- string redirectUri = "http://localhost:56789";
+ string redirectUri = "http://localhost:57461";
using HttpListener listener = new();
listener.Prefixes.Add(redirectUri + "/");
listener.Start();
diff --git a/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs b/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs
index 0a5719b71..1542de657 100644
--- a/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs
+++ b/src/Artemis.WebClient.Workshop/Services/WorkshopService.cs
@@ -69,7 +69,10 @@ public class WorkshopService : IWorkshopService
ProgressableStreamContent streamContent = new(request.File, progress);
streamContent.Headers.ContentType = new MediaTypeHeaderValue("image/png");
content.Add(streamContent, "file", "file.png");
-
+ content.Add(new StringContent(request.Name), "Name");
+ if (request.Description != null)
+ content.Add(new StringContent(request.Description), "Description");
+
// Submit
HttpResponseMessage response = await client.PostAsync($"entries/{entryId}/image", content, cancellationToken);
if (!response.IsSuccessStatusCode)