1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Layer properties - Implement INotifyPropertyChanged on BaseValue

Profile editor - Don't show expand button on property groups without children
Profile editor - Alert user about extra options on brushes
This commit is contained in:
Robert 2021-05-21 18:24:47 +02:00
parent 87dce788d7
commit 3825c34be1
3 changed files with 45 additions and 12 deletions

View File

@ -15,7 +15,7 @@ namespace Artemis.Core
/// </para>
/// </summary>
/// <typeparam name="T">The type of property encapsulated in this layer property</typeparam>
public class LayerProperty<T> : ILayerProperty
public class LayerProperty<T> : CorePropertyChanged, ILayerProperty
{
private bool _disposed;
@ -265,6 +265,7 @@ namespace Artemis.Core
_baseValue = value;
ReapplyUpdate();
OnPropertyChanged(nameof(BaseValue));
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Artemis.Core;
using Artemis.UI.Ninject.Factories;
@ -17,6 +18,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
private bool _isVisible;
private TreeGroupViewModel _treeGroupViewModel;
private TimelineGroupViewModel _timelineGroupViewModel;
private bool _hasChildren;
public LayerPropertyGroupViewModel(LayerPropertyGroup layerPropertyGroup, IProfileEditorService profileEditorService, ILayerPropertyVmFactory layerPropertyVmFactory)
{
@ -62,6 +64,11 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
}
}
public bool HasChildren
{
get => _hasChildren;
set => SetAndNotify(ref _hasChildren, value);
}
protected override void OnInitialActivate()
{
@ -169,6 +176,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
Items.Add(_layerPropertyVmFactory.LayerPropertyGroupViewModel(value));
}
}
HasChildren = Items.Any(i => i is LayerPropertyViewModel {IsVisible: true} || i is LayerPropertyGroupViewModel {IsVisible: true});
}
}
}

View File

@ -33,6 +33,7 @@
Foreground="{DynamicResource MaterialDesignBody}"
Style="{StaticResource MaterialDesignExpandCollapseToggleStyle}"
IsChecked="{Binding Path=LayerPropertyGroupViewModel.IsExpanded}"
Visibility="{Binding Path=LayerPropertyGroupViewModel.HasChildren, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
ClickMode="Press" />
<StackPanel Grid.Column="1">
@ -121,17 +122,39 @@
ToolTip="{Binding LayerPropertyGroup.LayerBrush.Descriptor.Description}"
Margin="0 5 0 0" />
<Button Grid.Column="3"
Style="{StaticResource MaterialDesignIconButton}"
ToolTip="Open brush settings"
Width="24"
Height="24"
VerticalAlignment="Center"
HorizontalAlignment="Right"
Command="{s:Action OpenBrushSettings}"
Visibility="{Binding LayerPropertyGroup.LayerBrush.ConfigurationDialog, Converter={StaticResource NullToVisibilityConverter}}">
<materialDesign:PackIcon Kind="Settings" Height="16" Width="16" />
</Button>
<StackPanel Grid.Column="3"
Orientation="Horizontal"
HorizontalAlignment="Right"
Visibility="{Binding LayerPropertyGroup.LayerBrush.ConfigurationDialog, Converter={StaticResource NullToVisibilityConverter}}">
<TextBlock VerticalAlignment="Center">Extra options available!</TextBlock>
<materialDesign:PackIcon Kind="ChevronRight" VerticalAlignment="Center">
<materialDesign:PackIcon.RenderTransform>
<TranslateTransform X="0" />
</materialDesign:PackIcon.RenderTransform>
<materialDesign:PackIcon.Triggers>
<EventTrigger RoutedEvent="materialDesign:PackIcon.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(materialDesign:PackIcon.RenderTransform).(TranslateTransform.X)"
From="0"
To="2"
Duration="0:0:0.5"
AutoReverse="True"
RepeatBehavior="Forever">
<DoubleAnimation.EasingFunction>
<CubicEase EasingMode="EaseInOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</materialDesign:PackIcon.Triggers>
</materialDesign:PackIcon>
<Button Style="{StaticResource MaterialDesignIconButton}" ToolTip="Open brush settings" Width="24" Height="24" HorizontalAlignment="Right" Command="{s:Action OpenBrushSettings}">
<materialDesign:PackIcon Kind="Settings" Height="16" Width="16" />
</Button>
</StackPanel>
</Grid>
<!-- Type: LayerEffectRoot -->