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

Project - Cleaned up some test code

UI - Added scaffolding for databindings
This commit is contained in:
Robert 2020-08-28 21:34:28 +02:00
parent a177188ce7
commit ef9cfb9ce8
28 changed files with 437 additions and 453 deletions

View File

@ -26,7 +26,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types
public override List<PropertyInfo> GetDataBindingProperties()
{
return typeof(SKSize).GetProperties().ToList();
return typeof(SKSize).GetProperties().Where(p => p.CanWrite).ToList();
}
}
}

View File

@ -156,7 +156,7 @@ namespace Artemis.UI.Shared.DataModelVisualization.Shared
if (Children.Any())
{
foreach (var child in Children)
child.ApplyTypeFilter(looseMatch, filteredTypes);
child?.ApplyTypeFilter(looseMatch, filteredTypes);
IsMatchingFilteredTypes = true;
return;

View File

@ -172,9 +172,5 @@
</materialDesign:ColorZone>
</Grid>
</Grid>
</materialDesign:Transitioner>
</UserControl>

View File

@ -0,0 +1,271 @@
<UserControl x:Class="Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DataBindingView"
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:local="clr-namespace:Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
xmlns:utilities="clr-namespace:Artemis.UI.Utilities"
xmlns:dd="urn:gong-wpf-dragdrop"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Artemis.UI;component/ResourceDictionaries/DisplayConditions.xaml" />
<ResourceDictionary>
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
<utilities:BindingProxy x:Key="DataContextProxy" Data="{Binding}" />
<DataTemplate x:Key="DataModelDataTemplate">
<Control x:Name="TemplateControl" Focusable="False" Template="{StaticResource DataModelSelectionTemplate}" />
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Data.ShowDataModelValues.Value, Source={StaticResource DataContextProxy}}" Value="True">
<Setter TargetName="TemplateControl" Property="Template" Value="{StaticResource DataModelSelectionTemplateWithValues}" />
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid Margin="10 0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.75*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid Margin="0 5 5 0">
<Grid.RowDefinitions>
<RowDefinition Height="48" />
<RowDefinition Height="48" />
<RowDefinition Height="48" />
<RowDefinition Height="48" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Margin="-3 0 0 0">
<Label FontSize="10" Foreground="{StaticResource MaterialDesignNavigationItemSubheader}" Margin="0 0 0 2">Source</Label>
<Button Background="#ab47bc"
BorderBrush="#ab47bc"
Style="{StaticResource DisplayConditionButton}"
ToolTip="{Binding SelectedLeftSideProperty.DisplayPropertyPath}"
HorizontalAlignment="Left">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding LeftSideDataModel.Children}" IsOpen="{Binding LeftSideDataModelOpen, Mode=OneWayToSource}">
<ContextMenu.ItemContainerStyle>
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
<Setter Property="ItemsSource" Value="{Binding Children}" />
<Setter Property="Command" Value="{Binding Data.SelectLeftPropertyCommand, Source={StaticResource DataContextProxy}}" />
<Setter Property="CommandParameter" Value="{Binding}" />
<Setter Property="CommandTarget" Value="{Binding}" />
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
<Setter Property="IsSubmenuOpen" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
<Setter Property="HeaderTemplate" Value="{StaticResource DataModelDataTemplate}" />
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
</Button.ContextMenu>
<Grid>
<TextBlock Text="{Binding SelectedLeftSideProperty.PropertyDescription.Name}"
Visibility="{Binding SelectedLeftSideProperty, Converter={StaticResource NullToVisibilityConverter}}" />
<TextBlock Text="« Select a property »"
FontStyle="Italic"
Visibility="{Binding SelectedLeftSideProperty, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}" />
</Grid>
</Button>
</StackPanel>
<ComboBox Grid.Row="1"
Style="{StaticResource MaterialDesignFloatingHintComboBox}"
materialDesign:HintAssist.Hint="Mode"
MinWidth="128">
<ComboBoxItem>
Replace value
</ComboBoxItem>
<ComboBoxItem>
Add to value
</ComboBoxItem>
<ComboBoxItem>
Subtract from value
</ComboBoxItem>
</ComboBox>
<StackPanel Grid.Row="2">
<TextBox Style="{StaticResource MaterialDesignFloatingHintTextBox}"
Text="200"
materialDesign:TextFieldAssist.HasClearButton="True"
materialDesign:TextFieldAssist.SuffixText="ms"
materialDesign:HintAssist.Hint="Smoothing time" />
</StackPanel>
<ComboBox Grid.Row="3"
Style="{StaticResource MaterialDesignFloatingHintComboBox}"
materialDesign:HintAssist.Hint="Smoothing type"
MinWidth="128">
<ComboBoxItem>
Ease in
</ComboBoxItem>
<ComboBoxItem>
Ease out
</ComboBoxItem>
<ComboBoxItem>
Ease in and out
</ComboBoxItem>
</ComboBox>
<materialDesign:Card Grid.Row="4" Grid.ColumnSpan="2" Margin="0 5 0 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Margin="10 10 4 0">
Test result
</TextBlock>
<Separator Grid.Row="1" Style="{StaticResource MaterialDesignLightSeparator}" Margin="0" />
<Grid Grid.Row="2" Margin="10 4 10 10">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Margin="0 2">Input</TextBlock>
<TextBlock Grid.Row="0" Grid.Column="1" Margin="0 2" FontFamily="Consolas">1250</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0 2">Output</TextBlock>
<TextBlock Grid.Row="1" Grid.Column="1" Margin="0 2" FontFamily="Consolas">909</TextBlock>
</Grid>
</Grid>
</materialDesign:Card>
</Grid>
<Grid Grid.Column="1">
<Grid Margin="5 26 0 0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Style="{StaticResource MaterialDesignFlatMidBgButton}"
HorizontalAlignment="Left"
FontSize="12"
Padding="6 4"
Height="22">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Margin="0 -1 4 0" Kind="Plus" />
<TextBlock>
Add modifier
</TextBlock>
</StackPanel>
</Button>
<!-- ItemsSource="{Binding ModifierViewModels}" -->
<ListBox Grid.Row="1"
materialDesign:RippleAssist.IsDisabled="True"
dd:DragDrop.IsDragSource="True"
dd:DragDrop.IsDropTarget="True"
dd:DragDrop.UseDefaultDragAdorner="True"
dd:DragDrop.DropHandler="{Binding}"
HorizontalContentAlignment="Stretch">
<!-- <ListBox.ItemTemplate> -->
<!-- <DataTemplate> -->
<!-- <ContentControl s:View.Model="{Binding}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" IsTabStop="False" /> -->
<!-- </DataTemplate> -->
<!-- </ListBox.ItemTemplate> -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
ToolTip="Delete the modifier"
Style="{StaticResource MaterialDesignIconForegroundButton}"
HorizontalAlignment="Left"
Foreground="#E74C4C"
Width="25"
Height="25"
Command="{s:Action Delete}">
<materialDesign:PackIcon Kind="Close" Width="18" Height="18" />
</Button>
<Button Grid.Column="1"
ToolTip="Swap modifier type to static/dynamic"
Style="{StaticResource MaterialDesignIconForegroundButton}"
HorizontalAlignment="Left"
Foreground="{StaticResource SecondaryAccentBrush}"
Width="25"
Height="25"
Command="{s:Action SwapType}">
<materialDesign:PackIcon Kind="SwapHorizontalVariant" Width="18" Height="18" />
</Button>
<Button Grid.Column="2"
Style="{StaticResource DisplayConditionButtonLeftClickMenu}"
Background="#7B7B7B"
BorderBrush="#7B7B7B"
Content="{Binding SelectedOperator.Description}">
<!-- Click="PropertyButton_OnClick" -->
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding Operators}">
<ContextMenu.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="{Binding Icon}" VerticalAlignment="Center" Margin="0 0 15 0" />
<TextBlock Text="{Binding Description}" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</ContextMenu.ItemTemplate>
<ContextMenu.ItemContainerStyle>
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
<Setter Property="Command" Value="{Binding Data.SelectOperatorCommand, Source={StaticResource DataContextProxy}}" />
<Setter Property="CommandParameter" Value="{Binding}" />
<Setter Property="CommandTarget" Value="{Binding}" />
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
</Button.ContextMenu>
</Button>
<Button Grid.Column="3"
Background="#ab47bc"
BorderBrush="#ab47bc"
Style="{StaticResource DisplayConditionButton}"
ToolTip="{Binding SelectedLeftSideProperty.DisplayPropertyPath}"
HorizontalAlignment="Left">
<Button.ContextMenu>
<ContextMenu ItemsSource="{Binding LeftSideDataModel.Children}" IsOpen="{Binding LeftSideDataModelOpen, Mode=OneWayToSource}">
<ContextMenu.ItemContainerStyle>
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}">
<Setter Property="ItemsSource" Value="{Binding Children}" />
<Setter Property="Command" Value="{Binding Data.SelectLeftPropertyCommand, Source={StaticResource DataContextProxy}}" />
<Setter Property="CommandParameter" Value="{Binding}" />
<Setter Property="CommandTarget" Value="{Binding}" />
<Setter Property="IsEnabled" Value="{Binding IsMatchingFilteredTypes}" />
<Setter Property="IsSubmenuOpen" Value="{Binding IsVisualizationExpanded, Mode=TwoWay}" />
<Setter Property="HeaderTemplate" Value="{StaticResource DataModelDataTemplate}" />
</Style>
</ContextMenu.ItemContainerStyle>
</ContextMenu>
</Button.ContextMenu>
<Grid>
<TextBlock Text="{Binding SelectedLeftSideProperty.PropertyDescription.Name}"
Visibility="{Binding SelectedLeftSideProperty, Converter={StaticResource NullToVisibilityConverter}}" />
<TextBlock Text="« Select a property »"
FontStyle="Italic"
Visibility="{Binding SelectedLeftSideProperty, Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=Inverted}" />
</Grid>
</Button>
</Grid>
</ListBox>
</Grid>
</Grid>
</Grid>
</ScrollViewer>
</UserControl>

View File

@ -4,9 +4,9 @@ using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
{
public class DataBindingsTabViewModel : PropertyChangedBase
public class DataBindingViewModel : PropertyChangedBase
{
public DataBindingsTabViewModel(BaseLayerProperty layerProperty, PropertyInfo dataBindingProperty)
public DataBindingViewModel(BaseLayerProperty layerProperty, PropertyInfo dataBindingProperty)
{
DisplayName = dataBindingProperty.Name.ToUpper();
LayerProperty = layerProperty;

View File

@ -1,12 +0,0 @@
<UserControl x:Class="Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DataBindingsTabView"
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:local="clr-namespace:Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,18 @@
<UserControl x:Class="Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DataBindingsTabsView"
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:local="clr-namespace:Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<TabControl ItemsSource="{Binding Tabs}" DisplayMemberPath="DisplayName" Style="{StaticResource MaterialDesignTabControl}" >
<TabControl.ContentTemplate>
<DataTemplate>
<ContentControl s:View.Model="{Binding}" TextElement.Foreground="{DynamicResource MaterialDesignBody}" />
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</UserControl>

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
{
public class DataBindingsTabsViewModel : PropertyChangedBase
{
public DataBindingsTabsViewModel()
{
Tabs = new BindableCollection<DataBindingViewModel>();
}
public BindableCollection<DataBindingViewModel> Tabs { get; set; }
}
}

View File

@ -9,16 +9,9 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance local:DataBindingsViewModel}">
<TabControl Margin="0 -1 0 0"
ItemsSource="{Binding Tabs}"
DisplayMemberPath="DisplayName"
Style="{StaticResource MaterialDesignTabControl}">
<TabControl.ContentTemplate>
<DataTemplate>
<materialDesign:TransitioningContent OpeningEffect="{materialDesign:TransitionEffect FadeIn}">
<ContentControl s:View.Model="{Binding}" TextElement.Foreground="{DynamicResource MaterialDesignBody}" />
</materialDesign:TransitioningContent>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
<Grid>
<!-- Use tabs for multiple properties only, only one of these VMs is set -->
<ContentControl s:View.Model="{Binding DataBindingsTabsViewModel}" />
<ContentControl s:View.Model="{Binding DataBindingViewModel}" />
</Grid>
</UserControl>

View File

@ -1,25 +1,50 @@
using Artemis.Core.Models.Profile.LayerProperties;
using System.Linq;
using Artemis.Core.Models.Profile.LayerProperties;
using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings
{
public class DataBindingsViewModel : PropertyChangedBase
{
private DataBindingViewModel _dataBindingViewModel;
private DataBindingsTabsViewModel _dataBindingsTabsViewModel;
public DataBindingsViewModel(BaseLayerProperty layerProperty)
{
Tabs = new BindableCollection<DataBindingsTabViewModel>();
LayerProperty = layerProperty;
Initialise();
}
public BindableCollection<DataBindingsTabViewModel> Tabs { get; set; }
public BaseLayerProperty LayerProperty { get; }
public DataBindingViewModel DataBindingViewModel
{
get => _dataBindingViewModel;
set => SetAndNotify(ref _dataBindingViewModel, value);
}
public DataBindingsTabsViewModel DataBindingsTabsViewModel
{
get => _dataBindingsTabsViewModel;
set => SetAndNotify(ref _dataBindingsTabsViewModel, value);
}
private void Initialise()
{
foreach (var dataBindingProperty in LayerProperty.GetDataBindingProperties())
Tabs.Add(new DataBindingsTabViewModel(LayerProperty, dataBindingProperty));
var properties = LayerProperty.GetDataBindingProperties();
if (properties.Count == 0)
return;
if (properties.Count == 1)
{
DataBindingViewModel = new DataBindingViewModel(LayerProperty, properties.First());
}
else
{
DataBindingsTabsViewModel = new DataBindingsTabsViewModel();
foreach (var dataBindingProperty in LayerProperty.GetDataBindingProperties())
DataBindingsTabsViewModel.Tabs.Add(new DataBindingViewModel(LayerProperty, dataBindingProperty));
}
}
}
}

View File

@ -168,60 +168,34 @@
Grid.Column="2"
x:Name="RightSideTransitioner"
SelectedIndex="{Binding RightSideIndex}"
DefaultTransitionOrigin="0, 0.5"
AutoApplyTransitionOrigins="True">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="56" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
DefaultTransitionOrigin="0, 0.5">
<materialDesign:TransitionerSlide>
<materialDesign:TransitionerSlide.BackwardWipe>
<materialDesign:CircleWipe />
</materialDesign:TransitionerSlide.BackwardWipe>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="56" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- Timeline headers -->
<ScrollViewer Grid.Row="0" x:Name="TimelineHeaderScrollViewer" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" ScrollChanged="TimelineScrollChanged">
<Canvas Background="{DynamicResource MaterialDesignCardBackground}" Width="{Binding ActualWidth, ElementName=PropertyTimeLine}">
<!-- Timeline segments -->
<ContentControl Canvas.Left="{Binding EndTimelineSegmentViewModel.SegmentStartPosition}" s:View.Model="{Binding EndTimelineSegmentViewModel}" />
<ContentControl Canvas.Left="{Binding MainTimelineSegmentViewModel.SegmentStartPosition}" s:View.Model="{Binding MainTimelineSegmentViewModel}" />
<ContentControl Canvas.Left="{Binding StartTimelineSegmentViewModel.SegmentStartPosition}" s:View.Model="{Binding StartTimelineSegmentViewModel}" />
<!-- Timeline headers -->
<ScrollViewer Grid.Row="0" x:Name="TimelineHeaderScrollViewer" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" ScrollChanged="TimelineScrollChanged">
<Canvas Background="{DynamicResource MaterialDesignCardBackground}" Width="{Binding ActualWidth, ElementName=PropertyTimeLine}">
<!-- Timeline segments -->
<ContentControl Canvas.Left="{Binding EndTimelineSegmentViewModel.SegmentStartPosition}" s:View.Model="{Binding EndTimelineSegmentViewModel}" />
<ContentControl Canvas.Left="{Binding MainTimelineSegmentViewModel.SegmentStartPosition}" s:View.Model="{Binding MainTimelineSegmentViewModel}" />
<ContentControl Canvas.Left="{Binding StartTimelineSegmentViewModel.SegmentStartPosition}" s:View.Model="{Binding StartTimelineSegmentViewModel}" />
<!-- Timeline caret -->
<Polygon Canvas.Left="{Binding TimeCaretPosition}"
Cursor="SizeWE"
MouseDown="{s:Action TimelineMouseDown}"
MouseUp="{s:Action TimelineMouseUp}"
MouseMove="{s:Action TimelineMouseMove}"
Points="-8,0 -8,8 0,20, 8,8 8,0"
Fill="{StaticResource SecondaryAccentBrush}" />
<Line Canvas.Left="{Binding TimeCaretPosition}"
Cursor="SizeWE"
MouseDown="{s:Action TimelineMouseDown}"
MouseUp="{s:Action TimelineMouseUp}"
MouseMove="{s:Action TimelineMouseMove}"
X1="0"
X2="0"
Y1="0"
Y2="{Binding ActualHeight, ElementName=ContainerGrid}"
StrokeThickness="2"
Stroke="{StaticResource SecondaryAccentBrush}" />
<!-- Timeline header body -->
<controls:PropertyTimelineHeader Margin="0 25 0 0"
Fill="{DynamicResource MaterialDesignBody}"
PixelsPerSecond="{Binding ProfileEditorService.PixelsPerSecond}"
HorizontalOffset="{Binding ContentHorizontalOffset, ElementName=TimelineHeaderScrollViewer}"
VisibleWidth="{Binding ActualWidth, ElementName=TimelineHeaderScrollViewer}"
OffsetFirstValue="True"
Width="{Binding ActualWidth, ElementName=PropertyTimeLine}" />
</Canvas>
</ScrollViewer>
<!-- Timeline rails -->
<ScrollViewer x:Name="TimelineRailsScrollViewer" Grid.Row="1" Style="{StaticResource SvStyle}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
ScrollChanged="TimelineScrollChanged">
<Grid Background="{DynamicResource MaterialDesignToolBarBackground}">
<Canvas Grid.Column="0" Panel.ZIndex="1">
<!-- Timeline caret -->
<Polygon Canvas.Left="{Binding TimeCaretPosition}"
Cursor="SizeWE"
MouseDown="{s:Action TimelineMouseDown}"
MouseUp="{s:Action TimelineMouseUp}"
MouseMove="{s:Action TimelineMouseMove}"
Points="-8,0 -8,8 0,20, 8,8 8,0"
Fill="{StaticResource SecondaryAccentBrush}" />
<Line Canvas.Left="{Binding TimeCaretPosition}"
Cursor="SizeWE"
MouseDown="{s:Action TimelineMouseDown}"
@ -233,18 +207,54 @@
Y2="{Binding ActualHeight, ElementName=ContainerGrid}"
StrokeThickness="2"
Stroke="{StaticResource SecondaryAccentBrush}" />
</Canvas>
<ContentControl Grid.Column="0" s:View.Model="{Binding TimelineViewModel}" x:Name="PropertyTimeLine" />
</Grid>
</ScrollViewer>
</Grid>
<!-- Timeline header body -->
<controls:PropertyTimelineHeader Margin="0 25 0 0"
Fill="{DynamicResource MaterialDesignBody}"
PixelsPerSecond="{Binding ProfileEditorService.PixelsPerSecond}"
HorizontalOffset="{Binding ContentHorizontalOffset, ElementName=TimelineHeaderScrollViewer}"
VisibleWidth="{Binding ActualWidth, ElementName=TimelineHeaderScrollViewer}"
OffsetFirstValue="True"
Width="{Binding ActualWidth, ElementName=PropertyTimeLine}" />
</Canvas>
</ScrollViewer>
<!-- Timeline rails -->
<ScrollViewer Grid.Row="1"
x:Name="TimelineRailsScrollViewer"
Style="{StaticResource SvStyle}"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto"
ScrollChanged="TimelineScrollChanged">
<Grid Background="{DynamicResource MaterialDesignToolBarBackground}">
<Canvas Grid.Column="0" Panel.ZIndex="1">
<Line Canvas.Left="{Binding TimeCaretPosition}"
Cursor="SizeWE"
MouseDown="{s:Action TimelineMouseDown}"
MouseUp="{s:Action TimelineMouseUp}"
MouseMove="{s:Action TimelineMouseMove}"
X1="0"
X2="0"
Y1="0"
Y2="{Binding ActualHeight, ElementName=ContainerGrid}"
StrokeThickness="2"
Stroke="{StaticResource SecondaryAccentBrush}" />
</Canvas>
<ContentControl Grid.Column="0" s:View.Model="{Binding TimelineViewModel}" x:Name="PropertyTimeLine" />
</Grid>
</ScrollViewer>
</Grid>
</materialDesign:TransitionerSlide>
<materialDesign:TransitionerSlide>
<materialDesign:TransitionerSlide.BackwardWipe>
<materialDesign:CircleWipe />
</materialDesign:TransitionerSlide.BackwardWipe>
<ContentControl s:View.Model="{Binding DataBindingsViewModel}" Background="White"/>
<Grid Background="{StaticResource MaterialDesignPaper}">
<ContentControl s:View.Model="{Binding DataBindingsViewModel}" />
</Grid>
</materialDesign:TransitionerSlide>
</materialDesign:Transitioner>

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
@ -227,11 +228,9 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
{
RightSideIndex = 1;
DataBindingsViewModel = new DataBindingsViewModel(ProfileEditorService.SelectedDataBinding);
} else
{
RightSideIndex = 0;
DataBindingsViewModel = null;
}
else
RightSideIndex = 0;
}
#region View model managament

View File

@ -46,14 +46,14 @@
</ContentControl.Resources>
</ContentControl>
<Button Grid.Column="3"
Style="{StaticResource MaterialDesignIconButton}"
ToolTip="Change the property's data binding"
Width="24"
Height="24"
VerticalAlignment="Center"
Command="{s:Action OpenDataBindings}">
<materialDesign:PackIcon Kind="VectorLink" Height="16" Width="16" />
</Button>
<ToggleButton Grid.Column="3"
Style="{StaticResource MaterialDesignFlatPrimaryToggleButton}"
ToolTip="Change the property's data binding"
Width="20"
Height="20"
VerticalAlignment="Center"
IsChecked="{Binding DataBindingsOpen}">
<materialDesign:PackIcon Kind="VectorLink" Height="13" Width="13" />
</ToggleButton>
</Grid>
</UserControl>

View File

@ -9,7 +9,6 @@ using Stylet;
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
{
public class TreePropertyViewModel<T> : TreePropertyViewModel
{
private readonly IProfileEditorService _profileEditorService;
@ -21,6 +20,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
_profileEditorService = profileEditorService;
LayerPropertyViewModel = (LayerPropertyViewModel<T>) layerPropertyBaseViewModel;
PropertyInputViewModel = propertyInputViewModel;
_profileEditorService.SelectedDataBindingChanged += ProfileEditorServiceOnSelectedDataBindingChanged;
}
public LayerPropertyViewModel<T> LayerPropertyViewModel { get; }
@ -37,9 +38,10 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
set => ApplyKeyframesEnabled(value);
}
public void OpenDataBindings()
public bool DataBindingsOpen
{
_profileEditorService.ChangeSelectedDataBinding(LayerPropertyViewModel.BaseLayerProperty);
get => _profileEditorService.SelectedDataBinding == LayerPropertyViewModel.BaseLayerProperty;
set => _profileEditorService.ChangeSelectedDataBinding(value ? LayerPropertyViewModel.BaseLayerProperty : null);
}
public override void Dispose()
@ -47,6 +49,11 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
PropertyInputViewModel.Dispose();
}
private void ProfileEditorServiceOnSelectedDataBindingChanged(object sender, EventArgs e)
{
NotifyOfPropertyChange(nameof(DataBindingsOpen));
}
private void ApplyKeyframesEnabled(bool enable)
{
// If enabling keyframes for the first time, add a keyframe with the current value at the current position
@ -77,6 +84,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
}
public LayerPropertyBaseViewModel LayerPropertyBaseViewModel { get; }
public abstract void Dispose();
}
}

View File

@ -79,14 +79,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Devices.Deb
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Artemis.Plugins.Modules.Overlay", "Plugins\Artemis.Plugins.Modules.Overlay\Artemis.Plugins.Modules.Overlay.csproj", "{00318027-7FDB-4C86-AB86-9005A481E330}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestModules", "TestModules", "{7497B6D5-FA21-4BDB-A752-28C935B748D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestModule1", "Plugins\TestModules\TestModule1\TestModule1.csproj", "{CA3F9E44-10BE-4940-96A5-CA25750E40DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestModule2", "Plugins\TestModules\TestModule2\TestModule2.csproj", "{228EF084-4430-4D0E-B728-D47C1C35F34D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestModule3", "Plugins\TestModules\TestModule3\TestModule3.csproj", "{979A10FE-7994-4426-A542-97058163FC27}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -185,18 +177,6 @@ Global
{00318027-7FDB-4C86-AB86-9005A481E330}.Debug|x64.Build.0 = Debug|x64
{00318027-7FDB-4C86-AB86-9005A481E330}.Release|x64.ActiveCfg = Release|x64
{00318027-7FDB-4C86-AB86-9005A481E330}.Release|x64.Build.0 = Release|x64
{CA3F9E44-10BE-4940-96A5-CA25750E40DA}.Debug|x64.ActiveCfg = Debug|x64
{CA3F9E44-10BE-4940-96A5-CA25750E40DA}.Debug|x64.Build.0 = Debug|x64
{CA3F9E44-10BE-4940-96A5-CA25750E40DA}.Release|x64.ActiveCfg = Release|x64
{CA3F9E44-10BE-4940-96A5-CA25750E40DA}.Release|x64.Build.0 = Release|x64
{228EF084-4430-4D0E-B728-D47C1C35F34D}.Debug|x64.ActiveCfg = Debug|x64
{228EF084-4430-4D0E-B728-D47C1C35F34D}.Debug|x64.Build.0 = Debug|x64
{228EF084-4430-4D0E-B728-D47C1C35F34D}.Release|x64.ActiveCfg = Release|x64
{228EF084-4430-4D0E-B728-D47C1C35F34D}.Release|x64.Build.0 = Release|x64
{979A10FE-7994-4426-A542-97058163FC27}.Debug|x64.ActiveCfg = Debug|x64
{979A10FE-7994-4426-A542-97058163FC27}.Debug|x64.Build.0 = Debug|x64
{979A10FE-7994-4426-A542-97058163FC27}.Release|x64.ActiveCfg = Release|x64
{979A10FE-7994-4426-A542-97058163FC27}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -225,10 +205,6 @@ Global
{62214042-667E-4B29-B64E-1A68CE6FE209} = {2C1477DC-7A5C-4B65-85DB-1F16A18FB2EC}
{3D83760B-0A36-4C8F-978D-7949C3FC862B} = {88792A7E-F037-4280-81D3-B131508EF1D8}
{00318027-7FDB-4C86-AB86-9005A481E330} = {B258A061-FA19-4835-8DC4-E9C3AE3664A0}
{7497B6D5-FA21-4BDB-A752-28C935B748D2} = {B258A061-FA19-4835-8DC4-E9C3AE3664A0}
{CA3F9E44-10BE-4940-96A5-CA25750E40DA} = {7497B6D5-FA21-4BDB-A752-28C935B748D2}
{228EF084-4430-4D0E-B728-D47C1C35F34D} = {7497B6D5-FA21-4BDB-A752-28C935B748D2}
{979A10FE-7994-4426-A542-97058163FC27} = {7497B6D5-FA21-4BDB-A752-28C935B748D2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C203080A-4473-4CC2-844B-F552EA43D66A}

View File

@ -1,37 +0,0 @@
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Modules;
using SkiaSharp;
namespace TestModule1
{
// The core of your module. Hover over the method names to see a description.
public class PluginModule : ProfileModule
{
// This is the beginning of your plugin life cycle. Use this instead of a constructor.
public override void EnablePlugin()
{
DisplayName = "TestModule1";
DisplayIcon = "ToyBrickPlus";
DefaultPriorityCategory = ModulePriorityCategory.Normal;
}
// This is the end of your plugin life cycle.
public override void DisablePlugin()
{
// Make sure to clean up resources where needed (dispose IDisposables etc.)
}
public override void ModuleActivated(bool isOverride)
{
}
public override void ModuleDeactivated(bool isOverride)
{
}
}
}

View File

@ -1,9 +0,0 @@
{
"profiles": {
"ModuleProject": {
"commandName": "Executable",
"executablePath": "C:\\Repos\\Artemis\\src\\Artemis.UI\\bin\\x64\\Debug\\netcoreapp3.1\\Artemis.UI.exe",
"workingDirectory": "C:\\Repos\\Artemis\\src\\Artemis.UI\\bin\\x64\\Debug\\netcoreapp3.1"
}
}
}

View File

@ -1,39 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
<AssemblyName>TestModule1</AssemblyName>
<RootNamespace>TestModule1</RootNamespace>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="Artemis.Core">
<HintPath>C:\Repos\Artemis\src\Artemis.UI\bin\x64\Debug\netcoreapp3.1\Artemis.Core.dll</HintPath>
</Reference>
<Reference Include="Artemis.UI.Shared">
<HintPath>C:\Repos\Artemis\src\Artemis.UI\bin\x64\Debug\netcoreapp3.1\Artemis.UI.Shared.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
<Exec Command="echo Copying resources to plugin output directory&#xD;&#xA;XCOPY &quot;$(ProjectDir)Images&quot; &quot;$(TargetDir)Images&quot; /s /q /i /y&#xD;&#xA;XCOPY &quot;$(ProjectDir)Layouts&quot; &quot;$(TargetDir)Layouts&quot; /s /q /i /y&#xD;&#xA;echo Copying plugin to Artemis plugin directory&#xD;&#xA;XCOPY &quot;$(TargetDir.TrimEnd('\'))&quot; &quot;%25ProgramData%25\Artemis\Plugins\$(ProjectName)&quot; /s /q /i /y&#xD;&#xA;" />
</Target>
</Project>

View File

@ -1,7 +0,0 @@
{
"Guid": "e7aed08d-a998-457e-91d8-61cd5689896b",
"Name": "TestModule1",
"Description": "This is my awesome plugin",
"Version": "1.0.0.0",
"Main": "TestModule1.dll"
}

View File

@ -1,38 +0,0 @@
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Modules;
using SkiaSharp;
namespace TestModule2
{
// The core of your module. Hover over the method names to see a description.
public class PluginModule : ProfileModule
{
// This is the beginning of your plugin life cycle. Use this instead of a constructor.
public override void EnablePlugin()
{
DisplayName = "TestModule2";
DisplayIcon = "ToyBrickPlus";
DefaultPriorityCategory = ModulePriorityCategory.Application;
}
// This is the end of your plugin life cycle.
public override void DisablePlugin()
{
// Make sure to clean up resources where needed (dispose IDisposables etc.)
}
public override void ModuleActivated(bool isOverride)
{
// When this gets called your activation requirements have been met and the module will start displaying
}
public override void ModuleDeactivated(bool isOverride)
{
// When this gets called your activation requirements are no longer met and your module will stop displaying
}
}
}

View File

@ -1,9 +0,0 @@
{
"profiles": {
"ModuleProject": {
"commandName": "Executable",
"executablePath": "C:\\Repos\\Artemis\\src\\Artemis.UI\\bin\\x64\\Debug\\netcoreapp3.1\\Artemis.UI.exe",
"workingDirectory": "C:\\Repos\\Artemis\\src\\Artemis.UI\\bin\\x64\\Debug\\netcoreapp3.1"
}
}
}

View File

@ -1,39 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
<AssemblyName>TestModule2</AssemblyName>
<RootNamespace>TestModule2</RootNamespace>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="Artemis.Core">
<HintPath>C:\Repos\Artemis\src\Artemis.UI\bin\x64\Debug\netcoreapp3.1\Artemis.Core.dll</HintPath>
</Reference>
<Reference Include="Artemis.UI.Shared">
<HintPath>C:\Repos\Artemis\src\Artemis.UI\bin\x64\Debug\netcoreapp3.1\Artemis.UI.Shared.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
<Exec Command="echo Copying resources to plugin output directory&#xD;&#xA;XCOPY &quot;$(ProjectDir)Images&quot; &quot;$(TargetDir)Images&quot; /s /q /i /y&#xD;&#xA;XCOPY &quot;$(ProjectDir)Layouts&quot; &quot;$(TargetDir)Layouts&quot; /s /q /i /y&#xD;&#xA;echo Copying plugin to Artemis plugin directory&#xD;&#xA;XCOPY &quot;$(TargetDir.TrimEnd('\'))&quot; &quot;%25ProgramData%25\Artemis\Plugins\$(ProjectName)&quot; /s /q /i /y&#xD;&#xA;" />
</Target>
</Project>

View File

@ -1,7 +0,0 @@
{
"Guid": "5ea31fec-3774-4cbf-8774-1cab7caaaa18",
"Name": "TestModule2",
"Description": "This is my awesome plugin",
"Version": "1.0.0.0",
"Main": "TestModule2.dll"
}

View File

@ -1,40 +0,0 @@
using System.Collections.Generic;
using Artemis.Core.Plugins.DataModelExpansions;
using Artemis.Core.Plugins.DataModelExpansions.Attributes;
namespace TestModule3.DataModels
{
public class PluginDataModel : DataModel
{
public PluginDataModel()
{
PluginSubDataModel = new PluginSubDataModel();
}
// Your datamodel can have regular properties and you can annotate them if you'd like
[DataModelProperty(Name = "A test string", Description = "It doesn't do much, but it's there.")]
public string TemplateDataModelString { get; set; }
// You can even have classes in your datamodel, just don't forget to instantiate them ;)
[DataModelProperty(Name = "A class within the datamodel")]
public PluginSubDataModel PluginSubDataModel { get; set; }
}
public class PluginSubDataModel
{
public PluginSubDataModel()
{
ListOfInts = new List<int> { 1, 2, 3, 4, 5 };
}
// You don't need to annotate properties, they will still show up
public float FloatyFloat { get; set; }
// You can even have a list!
public List<int> ListOfInts { get; set; }
// If you don't want a property to show up in the datamodel, annotate it with DataModelIgnore
[DataModelIgnore]
public string MyDarkestSecret { get; set; }
}
}

View File

@ -1,36 +0,0 @@
using Artemis.Core.Models.Surface;
using Artemis.Core.Plugins.Modules;
using SkiaSharp;
using TestModule3.DataModels;
namespace TestModule3
{
// The core of your module. Hover over the method names to see a description.
public class PluginModule : ProfileModule<PluginDataModel>
{
// This is the beginning of your plugin life cycle. Use this instead of a constructor.
public override void EnablePlugin()
{
DisplayName = "TestModule3";
DisplayIcon = "ToyBrickPlus";
DefaultPriorityCategory = ModulePriorityCategory.Normal;
}
// This is the end of your plugin life cycle.
public override void DisablePlugin()
{
// Make sure to clean up resources where needed (dispose IDisposables etc.)
}
public override void ModuleActivated(bool isOverride)
{
}
public override void ModuleDeactivated(bool isOverride)
{
}
}
}

View File

@ -1,9 +0,0 @@
{
"profiles": {
"ModuleProject": {
"commandName": "Executable",
"executablePath": "C:\\Repos\\Artemis\\src\\Artemis.UI\\bin\\x64\\Debug\\netcoreapp3.1\\Artemis.UI.exe",
"workingDirectory": "C:\\Repos\\Artemis\\src\\Artemis.UI\\bin\\x64\\Debug\\netcoreapp3.1"
}
}
}

View File

@ -1,39 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ShouldIncludeNativeSkiaSharp>false</ShouldIncludeNativeSkiaSharp>
<AssemblyName>TestModule3</AssemblyName>
<RootNamespace>TestModule3</RootNamespace>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="1.68.3" />
<PackageReference Include="Stylet" Version="1.3.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="Artemis.Core">
<HintPath>C:\Repos\Artemis\src\Artemis.UI\bin\x64\Debug\netcoreapp3.1\Artemis.Core.dll</HintPath>
</Reference>
<Reference Include="Artemis.UI.Shared">
<HintPath>C:\Repos\Artemis\src\Artemis.UI\bin\x64\Debug\netcoreapp3.1\Artemis.UI.Shared.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
<Exec Command="echo Copying resources to plugin output directory&#xD;&#xA;XCOPY &quot;$(ProjectDir)Images&quot; &quot;$(TargetDir)Images&quot; /s /q /i /y&#xD;&#xA;XCOPY &quot;$(ProjectDir)Layouts&quot; &quot;$(TargetDir)Layouts&quot; /s /q /i /y&#xD;&#xA;echo Copying plugin to Artemis plugin directory&#xD;&#xA;XCOPY &quot;$(TargetDir.TrimEnd('\'))&quot; &quot;%25ProgramData%25\Artemis\Plugins\$(ProjectName)&quot; /s /q /i /y&#xD;&#xA;" />
</Target>
</Project>

View File

@ -1,7 +0,0 @@
{
"Guid": "48011e31-a309-4069-820e-e734f37fc79f",
"Name": "TestModule3",
"Description": "This is my awesome plugin",
"Version": "1.0.0.0",
"Main": "TestModule3.dll"
}