Project cleanup

This commit is contained in:
Robert committed 2020-02-13 15:17:58 +01:00
1 parent f5e95e43be
commit 3aa9a632ea
51 files changed
+440 -490

No files matched your search

@@ -20,10 +20,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
public class LayerPropertiesViewModel : ProfileEditorPanelViewModel
{
private readonly ICoreService _coreService;
private readonly List<LayerPropertyViewModel> _layerPropertyViewModels;
private readonly ILayerPropertyVmFactory _layerPropertyVmFactory;
private readonly IProfileEditorService _profileEditorService;
private readonly ISettingsService _settingsService;
private readonly List<LayerPropertyViewModel> _layerPropertyViewModels;
public LayerPropertiesViewModel(IProfileEditorService profileEditorService,
ICoreService coreService,
@@ -71,18 +71,18 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
public PropertyTreeViewModel PropertyTree { get; set; }
public PropertyTimelineViewModel PropertyTimeline { get; set; }
private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e)
{
NotifyOfPropertyChange(() => FormattedCurrentTime);
NotifyOfPropertyChange(() => TimeCaretPosition);
}
protected override void OnDeactivate()
{
Pause();
base.OnDeactivate();
}
private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e)
{
NotifyOfPropertyChange(() => FormattedCurrentTime);
NotifyOfPropertyChange(() => TimeCaretPosition);
}
#region View model managament
private void PopulateProperties(ProfileElement profileElement, ProfileElement previousProfileElement)
@@ -92,6 +92,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
previousLayer.LayerPropertyRegistered -= LayerOnPropertyRegistered;
previousLayer.LayerPropertyRemoved -= LayerOnPropertyRemoved;
}
if (profileElement is Layer layer)
{
// Create VMs for missing properties
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput;
using Artemis.UI.Services.Interfaces;
using Ninject;
@@ -47,21 +46,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
}
}
private void UpdateKeyframes()
{
// Either create a new first keyframe or clear all the keyframes
if (_keyframesEnabled)
LayerProperty.CreateNewKeyframe(_profileEditorService.CurrentTime, LayerProperty.GetCurrentValue());
else
LayerProperty.ClearKeyframes();
// Force the keyframe engine to update, the new keyframe is the current keyframe
LayerProperty.IsUsingKeyframes = _keyframesEnabled;
LayerProperty.KeyframeEngine?.Update(0);
_profileEditorService.UpdateSelectedProfileElement();
}
public PropertyInputViewModel GetPropertyInputViewModel()
{
// If the type is an enum type, search for Enum instead.
@@ -76,5 +60,20 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
match.Initialize(this);
return match;
}
private void UpdateKeyframes()
{
// Either create a new first keyframe or clear all the keyframes
if (_keyframesEnabled)
LayerProperty.CreateNewKeyframe(_profileEditorService.CurrentTime, LayerProperty.GetCurrentValue());
else
LayerProperty.ClearKeyframes();
// Force the keyframe engine to update, the new keyframe is the current keyframe
LayerProperty.IsUsingKeyframes = _keyframesEnabled;
LayerProperty.KeyframeEngine?.Update(0);
_profileEditorService.UpdateSelectedProfileElement();
}
}
}
@@ -1,12 +1,12 @@
<UserControl x:Class="Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput.BrushPropertyInputView"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0 0 5 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
@@ -19,10 +19,9 @@
ItemsSource="{Binding Path=EnumValues}"
SelectedValuePath="Value"
DisplayMemberPath="Description"
SelectedValue="{Binding Path=BrushInputValue}"
SelectedValue="{Binding Path=BrushInputValue}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"
materialDesign:ComboBoxAssist.ClassicMode="True">
</ComboBox>
materialDesign:ComboBoxAssist.ClassicMode="True" />
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>
</UserControl>
@@ -1,22 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
{
/// <summary>
/// Interaction logic for BrushPropertyInputView.xaml
/// Interaction logic for BrushPropertyInputView.xaml
/// </summary>
public partial class BrushPropertyInputView : UserControl
{
@@ -25,4 +12,4 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
InitializeComponent();
}
}
}
}
@@ -38,12 +38,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
}
}
protected override void OnInitialized()
{
UpdateEnumValues();
base.OnInitialized();
}
public void UpdateEnumValues()
{
var layerBrushProviders = _pluginService.GetPluginsOfType<LayerBrushProvider>();
@@ -64,5 +58,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
{
NotifyOfPropertyChange(() => BrushInputValue);
}
protected override void OnInitialized()
{
UpdateEnumValues();
base.OnInitialized();
}
}
}
@@ -20,10 +20,9 @@
ItemsSource="{Binding Path=EnumValues}"
SelectedValuePath="Value"
DisplayMemberPath="Description"
SelectedValue="{Binding Path=EnumInputValue}"
SelectedValue="{Binding Path=EnumInputValue}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"
materialDesign:ComboBoxAssist.ClassicMode="True">
</ComboBox>
materialDesign:ComboBoxAssist.ClassicMode="True" />
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>
@@ -1,22 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
{
/// <summary>
/// Interaction logic for EnumPropertyInputView.xaml
/// Interaction logic for EnumPropertyInputView.xaml
/// </summary>
public partial class EnumPropertyInputView : UserControl
{
@@ -25,4 +12,4 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
InitializeComponent();
}
}
}
}
@@ -22,14 +22,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
set => InputValue = value;
}
protected override void OnInitialized()
{
EnumValues = EnumUtilities.GetAllValuesAndDescriptions(LayerPropertyViewModel.LayerProperty.Type);
}
public override void Update()
{
NotifyOfPropertyChange(() => EnumInputValue);
}
protected override void OnInitialized()
{
EnumValues = EnumUtilities.GetAllValuesAndDescriptions(LayerPropertyViewModel.LayerProperty.Type);
}
}
}
@@ -17,7 +17,7 @@
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
Text="{Binding FloatInputValue}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"/>
RequestBringIntoView="{s:Action OnRequestBringIntoView}" />
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>
@@ -16,8 +16,8 @@
Padding="0 -1"
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
Text="{Binding IntInputValue}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"/>
Text="{Binding IntInputValue}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}" />
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>
@@ -47,7 +47,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
}
/// <summary>
/// Called by the view, prevents scrolling into view when scrubbing through the timeline
/// Called by the view, prevents scrolling into view when scrubbing through the timeline
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
@@ -56,6 +56,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
e.Handled = true;
}
public abstract void Update();
protected virtual void OnInitialized()
{
}
private void UpdateInputValue(object value)
{
LayerPropertyViewModel.LayerProperty.SetCurrentValue(value, ProfileEditorService.CurrentTime);
@@ -64,11 +70,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
ProfileEditorService.UpdateSelectedProfileElement();
}
protected virtual void OnInitialized()
{
}
public abstract void Update();
}
}
@@ -1,22 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
{
/// <summary>
/// Interaction logic for SKColorPropertyInputView.xaml
/// Interaction logic for SKColorPropertyInputView.xaml
/// </summary>
public partial class SKColorPropertyInputView : UserControl
{
@@ -25,4 +12,4 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
InitializeComponent();
}
}
}
}
@@ -18,7 +18,7 @@
HorizontalAlignment="Left"
ToolTip="X-coordinate (horizontal)"
Text="{Binding X}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"/>
RequestBringIntoView="{s:Action OnRequestBringIntoView}" />
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
<TextBox Width="60"
Margin="0 2"
@@ -26,8 +26,8 @@
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
ToolTip="Y-coordinate (vertical)"
Text="{Binding Y}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"/>
Text="{Binding Y}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}" />
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>
@@ -18,7 +18,7 @@
HorizontalAlignment="Left"
ToolTip="Height"
Text="{Binding Height}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"/>
RequestBringIntoView="{s:Action OnRequestBringIntoView}" />
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
<TextBox Width="60"
Margin="0 2"
@@ -27,7 +27,7 @@
HorizontalAlignment="Left"
ToolTip="Width"
Text="{Binding Width}"
RequestBringIntoView="{s:Action OnRequestBringIntoView}"/>
RequestBringIntoView="{s:Action OnRequestBringIntoView}" />
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>
@@ -4,13 +4,13 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
{
public abstract class PropertyTreeItemViewModel : PropertyChangedBase
{
public LayerPropertyViewModel LayerPropertyViewModel { get; }
protected PropertyTreeItemViewModel(LayerPropertyViewModel layerPropertyViewModel)
{
LayerPropertyViewModel = layerPropertyViewModel;
}
public LayerPropertyViewModel LayerPropertyViewModel { get; }
/// <summary>
/// Updates the tree item's input if it is visible and has keyframes enabled
/// </summary>
@@ -18,16 +18,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
public abstract void Update(bool forceUpdate);
/// <summary>
/// Removes the layer property recursively
/// Removes the layer property recursively
/// </summary>
/// <param name="layerPropertyViewModel"></param>
public abstract void RemoveLayerProperty(LayerPropertyViewModel layerPropertyViewModel);
/// <summary>
/// Adds the layer property recursively
/// Adds the layer property recursively
/// </summary>
/// <param name="layerPropertyViewModel"></param>
public abstract void AddLayerProperty(LayerPropertyViewModel layerPropertyViewModel);
}
}
@@ -1,5 +1,4 @@
using System.Linq;
using Artemis.Core.Events;
using Stylet;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Services.Interfaces;
using Stylet;
@@ -70,13 +69,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
PropertyTrackViewModels.Remove(vm);
}
private void CreateViewModels(LayerPropertyViewModel property)
{
PropertyTrackViewModels.Add(_propertyTrackVmFactory.Create(this, property));
foreach (var child in property.Children)
CreateViewModels(child);
}
public void UpdateKeyframePositions()
{
foreach (var viewModel in PropertyTrackViewModels)
@@ -95,5 +87,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
UpdateEndTime();
}
private void CreateViewModels(LayerPropertyViewModel property)
{
PropertyTrackViewModels.Add(_propertyTrackVmFactory.Create(this, property));
foreach (var child in property.Children)
CreateViewModels(child);
}
}
}
@@ -1,5 +1,4 @@
using System.Linq;
using Artemis.Core.Events;
using Artemis.UI.Ninject.Factories;
using Stylet;
@@ -9,7 +8,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
{
private readonly IPropertyTrackKeyframeVmFactory _propertyTrackKeyframeVmFactory;
public PropertyTrackViewModel(PropertyTimelineViewModel propertyTimelineViewModel, LayerPropertyViewModel layerPropertyViewModel, IPropertyTrackKeyframeVmFactory propertyTrackKeyframeVmFactory)
public PropertyTrackViewModel(PropertyTimelineViewModel propertyTimelineViewModel, LayerPropertyViewModel layerPropertyViewModel,
IPropertyTrackKeyframeVmFactory propertyTrackKeyframeVmFactory)
{
_propertyTrackKeyframeVmFactory = propertyTrackKeyframeVmFactory;
PropertyTimelineViewModel = propertyTimelineViewModel;