1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00
SpoinkyNL f1f0abfec5 Input - Polished up UI
Input - Added events to service
2020-11-23 19:41:48 +01:00

44 lines
1.1 KiB
C#

using System.Threading.Tasks;
using Artemis.UI.Shared.Services;
using FluentValidation;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.Dialogs
{
public class RenameViewModel : DialogViewModelBase
{
private string _elementName;
public RenameViewModel(IModelValidator<RenameViewModel> validator, string subject, string currentName) : base(validator)
{
Subject = subject;
ElementName = currentName;
}
public string Subject { get; }
public string ElementName
{
get => _elementName;
set => SetAndNotify(ref _elementName, value);
}
public async Task Accept()
{
await ValidateAsync();
if (HasErrors)
return;
Session.Close(ElementName);
}
}
public class ProfileElementRenameViewModelValidator : AbstractValidator<RenameViewModel>
{
public ProfileElementRenameViewModelValidator()
{
RuleFor(m => m.ElementName).NotEmpty().WithMessage("Element name may not be empty");
}
}
}