mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Brushes - Added brush presets
ColorGradient - Refactored so it implements IList
This commit is contained in:
1 parent
e32b181d9f
commit
3d38461bdd
18 files changed
+722
-419
No files matched your search
@@ -0,0 +1,42 @@
|
||||
<UserControl x:Class="Artemis.UI.Screens.ProfileEditor.Dialogs.LayerBrushPresetView"
|
||||
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:layerBrushes="clr-namespace:Artemis.Core.LayerBrushes;assembly=Artemis.Core"
|
||||
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<StackPanel Margin="16">
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline6TextBlock}">
|
||||
Select a brush preset
|
||||
</TextBlock>
|
||||
|
||||
<ListBox ItemsSource="{Binding Presets}" SelectedItem="{Binding SelectedPreset}" HorizontalContentAlignment="Stretch" Margin="0 8 0 16">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type layerBrushes:ILayerBrushPreset}">
|
||||
<Border x:Name="Border" Padding="8" BorderThickness="0 0 0 1" BorderBrush="{DynamicResource MaterialDesignDivider}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<shared:ArtemisIcon Icon="{Binding Icon}" VerticalAlignment="Center" Width="30" Height="30"/>
|
||||
<StackPanel Margin="8 0 0 0" Grid.Column="1">
|
||||
<TextBlock FontWeight="Bold" Text="{Binding Name}" />
|
||||
<TextBlock Text="{Binding Description}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0" Command="{s:Action Cancel}">
|
||||
USE DEFAULT SETTINGS
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
{
|
||||
public class LayerBrushPresetViewModel : DialogViewModelBase
|
||||
{
|
||||
private ILayerBrushPreset _selectedPreset;
|
||||
|
||||
public LayerBrushPresetViewModel(BaseLayerBrush layerBrush)
|
||||
{
|
||||
Presets = new BindableCollection<ILayerBrushPreset>();
|
||||
Presets.AddRange(layerBrush.Presets);
|
||||
}
|
||||
|
||||
public BindableCollection<ILayerBrushPreset> Presets { get; }
|
||||
|
||||
public ILayerBrushPreset SelectedPreset
|
||||
{
|
||||
get => _selectedPreset;
|
||||
set
|
||||
{
|
||||
SetAndNotify(ref _selectedPreset, value);
|
||||
SelectPreset(value);
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectPreset(ILayerBrushPreset preset)
|
||||
{
|
||||
preset.Apply();
|
||||
Execute.OnUIThreadAsync(async () =>
|
||||
{
|
||||
await Task.Delay(250);
|
||||
Session?.Close(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user