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

40 lines
1001 B
C#

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