Profile editor - Added profile rename

Profile editor - Cleaned up buttons next to profile selection
This commit is contained in:
Robert committed 2020-12-17 21:09:42 +01:00
1 parent 3792dd53d2
commit e61a031485
8 files changed
+174 -56

No files matched your search

@@ -0,0 +1,29 @@
<UserControl x:Class="Artemis.UI.Screens.ProfileEditor.Dialogs.ProfileEditView"
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:s="https://github.com/canton7/Stylet"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="213.053" d:DesignWidth="254.425">
<StackPanel Margin="16">
<TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}">
Edit profile
</TextBlock>
<TextBox materialDesign:HintAssist.Hint="Profile name"
Margin="0 8 0 16"
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="{Binding ProfileName, UpdateSourceTrigger=PropertyChanged}" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{s:Action Cancel}">
CANCEL
</Button>
<Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{s:Action Accept}">
ACCEPT
</Button>
</StackPanel>
</StackPanel>
</UserControl>
@@ -0,0 +1,42 @@
using System.Threading.Tasks;
using Artemis.Core;
using Artemis.UI.Shared.Services;
using FluentValidation;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.Dialogs
{
public class ProfileEditViewModel : DialogViewModelBase
{
private string _profileName;
public ProfileEditViewModel(IModelValidator<ProfileEditViewModel> validator, Profile profile) : base(validator)
{
ProfileName = profile.Name;
}
public string ProfileName
{
get => _profileName;
set => SetAndNotify(ref _profileName, value);
}
public async Task Accept()
{
await ValidateAsync();
if (HasErrors)
return;
Session.Close(ProfileName);
}
}
public class ProfileEditViewModelValidator : AbstractValidator<ProfileEditViewModel>
{
public ProfileEditViewModelValidator()
{
RuleFor(m => m.ProfileName).NotEmpty().WithMessage("Profile name may not be empty");
}
}
}
@@ -17,11 +17,19 @@
Export current profile
</TextBlock>
<TextBlock Margin="0 10" TextAlignment="Justify" TextWrapping="Wrap" Grid.Row="1">
<TextBlock Grid.Row="1"
Margin="0 10"
TextWrapping="Wrap"
Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
Foreground="{DynamicResource MaterialDesignBodyLight}">
Please note that exporting profiles like this is placeholder functionality. The idea is that this will eventually happen via the workshop.
</TextBlock>
<TextBlock Margin="0 10" TextAlignment="Justify" TextWrapping="Wrap" Grid.Row="2">
<TextBlock Grid.Row="2"
Margin="0 10"
TextWrapping="Wrap"
Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
Foreground="{DynamicResource MaterialDesignBodyLight}">
The workshop will include tools to make profiles convert easily and look good on different layouts.
That means right now when someone imports this export unless they have the exact same setup as
you, they'll have to select LEDs for each layer in the profile.
@@ -19,11 +19,19 @@
Import profile to current module
</TextBlock>
<TextBlock Margin="0 10" TextAlignment="Justify" TextWrapping="Wrap" Grid.Row="1">
<TextBlock Grid.Row="1"
Margin="0 10"
TextWrapping="Wrap"
Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
Foreground="{DynamicResource MaterialDesignBodyLight}">
Please note that importing profiles like this is placeholder functionality. The idea is that this will eventually happen via the workshop.
</TextBlock>
<TextBlock Margin="0 10" TextAlignment="Justify" TextWrapping="Wrap" Grid.Row="2">
<TextBlock Grid.Row="2"
Margin="0 10"
TextWrapping="Wrap"
Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
Foreground="{DynamicResource MaterialDesignBodyLight}">
The workshop will include tools to make profiles convert easily and look good on different layouts.
That means right now when you import this profile unless you have the exact same setup as
the person who exported it, you'll have to select LEDs for each layer in the profile.