mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Notifications - Fixed positioning in main window,
Notifications - Added vertical stacking
This commit is contained in:
parent
8faa6b7a49
commit
fac7a618e7
@ -69,7 +69,14 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
|
|
||||||
// Render device and LED images
|
// Render device and LED images
|
||||||
if (_deviceImage != null)
|
if (_deviceImage != null)
|
||||||
drawingContext.DrawImage(_deviceImage, new Rect(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height));
|
{
|
||||||
|
drawingContext.DrawImage(
|
||||||
|
_deviceImage,
|
||||||
|
new Rect(_deviceImage.Size),
|
||||||
|
new Rect(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height),
|
||||||
|
RenderOptions.GetBitmapInterpolationMode(this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ShowColors)
|
if (!ShowColors)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -26,12 +26,7 @@ public class NotificationBuilder
|
|||||||
public NotificationBuilder(Window parent)
|
public NotificationBuilder(Window parent)
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
_infoBar = new InfoBar
|
_infoBar = new InfoBar {Classes = Classes.Parse("notification-info-bar")};
|
||||||
{
|
|
||||||
Classes = Classes.Parse("notification-info-bar"),
|
|
||||||
VerticalAlignment = VerticalAlignment.Bottom,
|
|
||||||
HorizontalAlignment = HorizontalAlignment.Right
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -121,8 +116,9 @@ public class NotificationBuilder
|
|||||||
/// <exception cref="ArtemisSharedUIException" />
|
/// <exception cref="ArtemisSharedUIException" />
|
||||||
public Action Show()
|
public Action Show()
|
||||||
{
|
{
|
||||||
if (_parent.Content is not Panel panel)
|
IPanel? panel = _parent.Find<IPanel>("NotificationContainer");
|
||||||
throw new ArtemisSharedUIException("Can't display a notification on a window without a panel at its root.");
|
if (panel == null)
|
||||||
|
throw new ArtemisSharedUIException("Can't display a notification on a window without a NotificationContainer.");
|
||||||
|
|
||||||
Dispatcher.UIThread.Post(() =>
|
Dispatcher.UIThread.Post(() =>
|
||||||
{
|
{
|
||||||
|
|||||||
@ -35,9 +35,10 @@
|
|||||||
<StyleInclude Source="/Styles/Sidebar.axaml" />
|
<StyleInclude Source="/Styles/Sidebar.axaml" />
|
||||||
<StyleInclude Source="/Styles/InfoBar.axaml" />
|
<StyleInclude Source="/Styles/InfoBar.axaml" />
|
||||||
<StyleInclude Source="/Styles/TextBox.axaml" />
|
<StyleInclude Source="/Styles/TextBox.axaml" />
|
||||||
|
<StyleInclude Source="/Styles/Notifications.axaml" />
|
||||||
<StyleInclude Source="/Styles/NumberBox.axaml" />
|
<StyleInclude Source="/Styles/NumberBox.axaml" />
|
||||||
<StyleInclude Source="/Styles/TreeView.axaml" />
|
<StyleInclude Source="/Styles/TreeView.axaml" />
|
||||||
|
|
||||||
<Style Selector="Window:windows:windows10 /template/ Border#RootBorder">
|
<Style Selector="Window:windows:windows10 /template/ Border#RootBorder">
|
||||||
<!-- This will show if custom accent color setting is used in Settings page-->
|
<!-- This will show if custom accent color setting is used in Settings page-->
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColor}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColor}" />
|
||||||
|
|||||||
@ -3,8 +3,13 @@
|
|||||||
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker"
|
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker"
|
||||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia">
|
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia">
|
||||||
<Design.PreviewWith>
|
<Design.PreviewWith>
|
||||||
<Border Padding="20">
|
<Border Padding="20" Width="200">
|
||||||
<gradientPicker:GradientPickerButton IsCompact="True" />
|
<StackPanel Spacing="5">
|
||||||
|
<gradientPicker:GradientPickerButton IsCompact="True" />
|
||||||
|
<ComboBox HorizontalAlignment="Stretch"></ComboBox>
|
||||||
|
<controls:DropDownButton HorizontalAlignment="Stretch"></controls:DropDownButton>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
</Border>
|
</Border>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
|
|
||||||
@ -25,31 +30,33 @@
|
|||||||
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate>
|
<ControlTemplate>
|
||||||
<Grid ColumnDefinitions="*,Auto">
|
|
||||||
<controls:Button Grid.Column="0"
|
<controls:Button Grid.Column="0"
|
||||||
Name="MainButton"
|
Name="MainButton"
|
||||||
Padding="0 0 25 0"
|
Padding="0 0 12 0"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
VerticalContentAlignment="Stretch">
|
VerticalContentAlignment="Stretch">
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
<Border Classes="gradient-display"
|
<Border Classes="gradient-display"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Background="{TemplateBinding LinearGradientBrush}" />
|
Background="{TemplateBinding LinearGradientBrush}" />
|
||||||
</controls:Button>
|
<TextBlock Name="ChevronTextBlock"
|
||||||
|
Grid.Column="1"
|
||||||
|
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||||
|
FontSize="13"
|
||||||
|
Text=""
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Padding="2,2,2,0"
|
||||||
|
Margin="4,0,0,0" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</controls:Button>
|
||||||
|
|
||||||
|
|
||||||
<Viewbox Grid.Column="1"
|
|
||||||
Width="18"
|
|
||||||
Height="18"
|
|
||||||
IsHitTestVisible="False"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
Margin="-25 0 8 0"
|
|
||||||
Name="Chevron">
|
|
||||||
<controls:SymbolIcon Symbol="ChevronDown" />
|
|
||||||
</Viewbox>
|
|
||||||
</Grid>
|
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
@ -60,4 +67,11 @@
|
|||||||
<Setter Property="BorderThickness" Value="1" />
|
<Setter Property="BorderThickness" Value="1" />
|
||||||
<Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius}" />
|
<Setter Property="CornerRadius" Value="{TemplateBinding CornerRadius}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="gradientPicker|GradientPickerButton /template/ TextBlock#ChevronTextBlock">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundPressed}" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="gradientPicker|GradientPickerButton[IsEnabled=False] /template/ TextBlock#ChevronTextBlock">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundDisabled}" />
|
||||||
|
</Style>
|
||||||
</Styles>
|
</Styles>
|
||||||
27
src/Avalonia/Artemis.UI.Shared/Styles/Notifications.axaml
Normal file
27
src/Avalonia/Artemis.UI.Shared/Styles/Notifications.axaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<Styles xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia">
|
||||||
|
<Design.PreviewWith>
|
||||||
|
<Border Padding="20">
|
||||||
|
<!-- Add Controls for Previewer Here -->
|
||||||
|
</Border>
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
|
<Style Selector="StackPanel.notification-container">
|
||||||
|
<Setter Property="Spacing" Value="-25" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="StackPanel.notification-container controls|InfoBar">
|
||||||
|
<Setter Property="MaxHeight" Value="0" />
|
||||||
|
<Style.Animations>
|
||||||
|
<Animation Duration="0:0:0.2" Easing="CubicEaseOut" FillMode="Forward">
|
||||||
|
<KeyFrame Cue="0%">
|
||||||
|
<Setter Property="MaxHeight" Value="0" />
|
||||||
|
</KeyFrame>
|
||||||
|
<KeyFrame Cue="100%">
|
||||||
|
<Setter Property="MaxHeight" Value="50" />
|
||||||
|
</KeyFrame>
|
||||||
|
</Animation>
|
||||||
|
</Style.Animations>
|
||||||
|
</Style>
|
||||||
|
</Styles>
|
||||||
@ -7,11 +7,14 @@
|
|||||||
x:Class="Artemis.UI.MainWindow"
|
x:Class="Artemis.UI.MainWindow"
|
||||||
Icon="/Assets/Images/Logo/application.ico"
|
Icon="/Assets/Images/Logo/application.ico"
|
||||||
Title="Artemis 2.0">
|
Title="Artemis 2.0">
|
||||||
<DockPanel>
|
<Panel>
|
||||||
<ContentControl Content="{Binding SidebarViewModel}" DockPanel.Dock="Left"></ContentControl>
|
<DockPanel>
|
||||||
<Border Background="Transparent" Name="TitleBar" DockPanel.Dock="Top">
|
<ContentControl Content="{Binding SidebarViewModel}" DockPanel.Dock="Left"></ContentControl>
|
||||||
<ContentControl Content="{Binding TitleBarViewModel}" />
|
<Border Background="Transparent" Name="TitleBar" DockPanel.Dock="Top">
|
||||||
</Border>
|
<ContentControl Content="{Binding TitleBarViewModel}" />
|
||||||
<ContentControl Content="{Binding}" />
|
</Border>
|
||||||
</DockPanel>
|
<ContentControl Content="{Binding}" />
|
||||||
|
</DockPanel>
|
||||||
|
<StackPanel Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
||||||
|
</Panel>
|
||||||
</controls:CoreWindow>
|
</controls:CoreWindow>
|
||||||
@ -20,51 +20,56 @@
|
|||||||
<Setter Property="Margin" Value="15 0 0 0" />
|
<Setter Property="Margin" Value="15 0 0 0" />
|
||||||
</Style>
|
</Style>
|
||||||
</Window.Styles>
|
</Window.Styles>
|
||||||
<controls:NavigationView x:Name="Navigation"
|
|
||||||
SelectedItem="{Binding SelectedItem}"
|
|
||||||
IsPaneToggleButtonVisible="False"
|
|
||||||
PaneDisplayMode="Left"
|
|
||||||
Margin="0 10 0 0">
|
|
||||||
<controls:NavigationView.MenuItems>
|
|
||||||
<controls:NavigationViewItem Tag="Rendering">
|
|
||||||
<controls:NavigationViewItem.Content>
|
|
||||||
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
|
||||||
<avalonia:MaterialIcon Kind="Paint" />
|
|
||||||
<TextBlock>Rendering</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
</controls:NavigationViewItem.Content>
|
|
||||||
</controls:NavigationViewItem>
|
|
||||||
<controls:NavigationViewItem Tag="DataModel">
|
|
||||||
<controls:NavigationViewItem.Content>
|
|
||||||
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
|
||||||
<avalonia:MaterialIcon Kind="FormatListBulletedType" />
|
|
||||||
<TextBlock>Data Model</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
</controls:NavigationViewItem.Content>
|
|
||||||
</controls:NavigationViewItem>
|
|
||||||
<controls:NavigationViewItem Tag="Performance">
|
|
||||||
<controls:NavigationViewItem.Content>
|
|
||||||
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
|
||||||
<avalonia:MaterialIcon Kind="Gauge" />
|
|
||||||
<TextBlock>Performance</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
</controls:NavigationViewItem.Content>
|
|
||||||
</controls:NavigationViewItem>
|
|
||||||
<controls:NavigationViewItem Tag="Logging">
|
|
||||||
<controls:NavigationViewItem.Content>
|
|
||||||
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
|
||||||
<avalonia:MaterialIcon Kind="Text" />
|
|
||||||
<TextBlock>Logging</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
</controls:NavigationViewItem.Content>
|
|
||||||
</controls:NavigationViewItem>
|
|
||||||
</controls:NavigationView.MenuItems>
|
|
||||||
|
|
||||||
<reactiveUi:RoutedViewHost Router="{Binding Router}" Padding="12">
|
<Panel>
|
||||||
<reactiveUi:RoutedViewHost.PageTransition>
|
<controls:NavigationView x:Name="Navigation"
|
||||||
<CrossFade Duration="0.1" />
|
SelectedItem="{Binding SelectedItem}"
|
||||||
</reactiveUi:RoutedViewHost.PageTransition>
|
IsPaneToggleButtonVisible="False"
|
||||||
</reactiveUi:RoutedViewHost>
|
PaneDisplayMode="Left"
|
||||||
|
Margin="0 10 0 0">
|
||||||
|
<controls:NavigationView.MenuItems>
|
||||||
|
<controls:NavigationViewItem Tag="Rendering">
|
||||||
|
<controls:NavigationViewItem.Content>
|
||||||
|
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
||||||
|
<avalonia:MaterialIcon Kind="Paint" />
|
||||||
|
<TextBlock>Rendering</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</controls:NavigationViewItem.Content>
|
||||||
|
</controls:NavigationViewItem>
|
||||||
|
<controls:NavigationViewItem Tag="DataModel">
|
||||||
|
<controls:NavigationViewItem.Content>
|
||||||
|
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
||||||
|
<avalonia:MaterialIcon Kind="FormatListBulletedType" />
|
||||||
|
<TextBlock>Data Model</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</controls:NavigationViewItem.Content>
|
||||||
|
</controls:NavigationViewItem>
|
||||||
|
<controls:NavigationViewItem Tag="Performance">
|
||||||
|
<controls:NavigationViewItem.Content>
|
||||||
|
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
||||||
|
<avalonia:MaterialIcon Kind="Gauge" />
|
||||||
|
<TextBlock>Performance</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</controls:NavigationViewItem.Content>
|
||||||
|
</controls:NavigationViewItem>
|
||||||
|
<controls:NavigationViewItem Tag="Logging">
|
||||||
|
<controls:NavigationViewItem.Content>
|
||||||
|
<StackPanel Orientation="Horizontal" Classes="sidebar-stackpanel">
|
||||||
|
<avalonia:MaterialIcon Kind="Text" />
|
||||||
|
<TextBlock>Logging</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</controls:NavigationViewItem.Content>
|
||||||
|
</controls:NavigationViewItem>
|
||||||
|
</controls:NavigationView.MenuItems>
|
||||||
|
|
||||||
</controls:NavigationView>
|
<reactiveUi:RoutedViewHost Router="{Binding Router}" Padding="12">
|
||||||
|
<reactiveUi:RoutedViewHost.PageTransition>
|
||||||
|
<CrossFade Duration="0.1" />
|
||||||
|
</reactiveUi:RoutedViewHost.PageTransition>
|
||||||
|
</reactiveUi:RoutedViewHost>
|
||||||
|
|
||||||
|
</controls:NavigationView>
|
||||||
|
<StackPanel Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
||||||
|
</Panel>
|
||||||
|
|
||||||
</controls:CoreWindow>
|
</controls:CoreWindow>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
<TextBlock Text="{Binding Renderer}"></TextBlock>
|
<TextBlock Text="{Binding Renderer}"></TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Border Classes="card">
|
<Border Classes="card" Padding="10">
|
||||||
<ZoomBorder Name="ZoomBorder"
|
<ZoomBorder Name="ZoomBorder"
|
||||||
Stretch="None"
|
Stretch="None"
|
||||||
ClipToBounds="True"
|
ClipToBounds="True"
|
||||||
|
|||||||
@ -61,6 +61,8 @@
|
|||||||
</TabControl.ContentTemplate>
|
</TabControl.ContentTemplate>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Grid.ColumnSpan="3" Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</controls1:CoreWindow>
|
</controls1:CoreWindow>
|
||||||
@ -12,5 +12,6 @@
|
|||||||
WindowStartupLocation="CenterOwner">
|
WindowStartupLocation="CenterOwner">
|
||||||
<Panel>
|
<Panel>
|
||||||
<ContentControl Content="{Binding ConfigurationViewModel}"></ContentControl>
|
<ContentControl Content="{Binding ConfigurationViewModel}"></ContentControl>
|
||||||
|
<StackPanel Classes="notification-container" Name="NotificationContainer" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>
|
||||||
</Panel>
|
</Panel>
|
||||||
</controls:CoreWindow>
|
</controls:CoreWindow>
|
||||||
|
|||||||
@ -12,11 +12,10 @@ using Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes;
|
|||||||
using Artemis.UI.Screens.ProfileEditor.Properties.Tree;
|
using Artemis.UI.Screens.ProfileEditor.Properties.Tree;
|
||||||
using Artemis.UI.Shared;
|
using Artemis.UI.Shared;
|
||||||
using Artemis.UI.Shared.Services.PropertyInput;
|
using Artemis.UI.Shared.Services.PropertyInput;
|
||||||
using ReactiveUI;
|
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.ProfileEditor.Properties;
|
namespace Artemis.UI.Screens.ProfileEditor.Properties;
|
||||||
|
|
||||||
public class PropertyGroupViewModel : ViewModelBase
|
public class PropertyGroupViewModel : ViewModelBase, IDisposable
|
||||||
{
|
{
|
||||||
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
|
||||||
private readonly IPropertyInputService _propertyInputService;
|
private readonly IPropertyInputService _propertyInputService;
|
||||||
@ -33,7 +32,7 @@ public class PropertyGroupViewModel : ViewModelBase
|
|||||||
TreeGroupViewModel = layerPropertyVmFactory.TreeGroupViewModel(this);
|
TreeGroupViewModel = layerPropertyVmFactory.TreeGroupViewModel(this);
|
||||||
TimelineGroupViewModel = layerPropertyVmFactory.TimelineGroupViewModel(this);
|
TimelineGroupViewModel = layerPropertyVmFactory.TimelineGroupViewModel(this);
|
||||||
|
|
||||||
// TODO: Centralize visibility updating or do it here and dispose
|
LayerPropertyGroup.VisibilityChanged += LayerPropertyGroupOnVisibilityChanged;
|
||||||
_isVisible = !LayerPropertyGroup.IsHidden;
|
_isVisible = !LayerPropertyGroup.IsHidden;
|
||||||
|
|
||||||
PopulateChildren();
|
PopulateChildren();
|
||||||
@ -86,10 +85,12 @@ public class PropertyGroupViewModel : ViewModelBase
|
|||||||
return result;
|
return result;
|
||||||
|
|
||||||
foreach (ViewModelBase child in Children)
|
foreach (ViewModelBase child in Children)
|
||||||
|
{
|
||||||
if (child is PropertyViewModel profileElementPropertyViewModel)
|
if (child is PropertyViewModel profileElementPropertyViewModel)
|
||||||
result.AddRange(profileElementPropertyViewModel.TimelinePropertyViewModel.GetAllKeyframeViewModels());
|
result.AddRange(profileElementPropertyViewModel.TimelinePropertyViewModel.GetAllKeyframeViewModels());
|
||||||
else if (child is PropertyGroupViewModel profileElementPropertyGroupViewModel)
|
else if (child is PropertyGroupViewModel profileElementPropertyGroupViewModel)
|
||||||
result.AddRange(profileElementPropertyGroupViewModel.GetAllKeyframeViewModels(expandedOnly));
|
result.AddRange(profileElementPropertyGroupViewModel.GetAllKeyframeViewModels(expandedOnly));
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -120,4 +121,20 @@ public class PropertyGroupViewModel : ViewModelBase
|
|||||||
|
|
||||||
HasChildren = Children.Any(i => i is PropertyViewModel {IsVisible: true} || i is PropertyGroupViewModel {IsVisible: true});
|
HasChildren = Children.Any(i => i is PropertyViewModel {IsVisible: true} || i is PropertyGroupViewModel {IsVisible: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LayerPropertyGroupOnVisibilityChanged(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
IsVisible = !LayerPropertyGroup.IsHidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
LayerPropertyGroup.VisibilityChanged -= LayerPropertyGroupOnVisibilityChanged;
|
||||||
|
foreach (ViewModelBase viewModelBase in Children)
|
||||||
|
{
|
||||||
|
if (viewModelBase is IDisposable disposable)
|
||||||
|
disposable.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,13 +1,13 @@
|
|||||||
using Artemis.Core;
|
using System;
|
||||||
|
using Artemis.Core;
|
||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
using Artemis.UI.Screens.ProfileEditor.Properties.Timeline;
|
using Artemis.UI.Screens.ProfileEditor.Properties.Timeline;
|
||||||
using Artemis.UI.Screens.ProfileEditor.Properties.Tree;
|
using Artemis.UI.Screens.ProfileEditor.Properties.Tree;
|
||||||
using Artemis.UI.Shared;
|
using Artemis.UI.Shared;
|
||||||
using ReactiveUI;
|
|
||||||
|
|
||||||
namespace Artemis.UI.Screens.ProfileEditor.Properties;
|
namespace Artemis.UI.Screens.ProfileEditor.Properties;
|
||||||
|
|
||||||
public class PropertyViewModel : ViewModelBase
|
public class PropertyViewModel : ViewModelBase, IDisposable
|
||||||
{
|
{
|
||||||
private bool _isExpanded;
|
private bool _isExpanded;
|
||||||
private bool _isHighlighted;
|
private bool _isHighlighted;
|
||||||
@ -19,7 +19,7 @@ public class PropertyViewModel : ViewModelBase
|
|||||||
TreePropertyViewModel = propertyVmFactory.TreePropertyViewModel(LayerProperty, this);
|
TreePropertyViewModel = propertyVmFactory.TreePropertyViewModel(LayerProperty, this);
|
||||||
TimelinePropertyViewModel = propertyVmFactory.TimelinePropertyViewModel(LayerProperty, this);
|
TimelinePropertyViewModel = propertyVmFactory.TimelinePropertyViewModel(LayerProperty, this);
|
||||||
|
|
||||||
// TODO: Centralize visibility updating or do it here and dispose
|
LayerProperty.VisibilityChanged += LayerPropertyOnVisibilityChanged;
|
||||||
_isVisible = !LayerProperty.IsHidden;
|
_isVisible = !LayerProperty.IsHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,4 +44,15 @@ public class PropertyViewModel : ViewModelBase
|
|||||||
get => _isExpanded;
|
get => _isExpanded;
|
||||||
set => RaiseAndSetIfChanged(ref _isExpanded, value);
|
set => RaiseAndSetIfChanged(ref _isExpanded, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LayerPropertyOnVisibilityChanged(object? sender, LayerPropertyEventArgs e)
|
||||||
|
{
|
||||||
|
IsVisible = !LayerProperty.IsHidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
LayerProperty.VisibilityChanged -= LayerPropertyOnVisibilityChanged;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using System.Reactive;
|
using System;
|
||||||
|
using System.Reactive;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.UI.Shared.Services.Builders;
|
using Artemis.UI.Shared.Services.Builders;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user