mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
UI - Restructured resources directory
UI - Fixed a few memory leaks
This commit is contained in:
1 parent
8b95243a7c
commit
2b66ba656b
41 files changed
+215
-123
No files matched your search
@@ -23,7 +23,7 @@
|
||||
Padding="1 0"
|
||||
Margin="0 4 0 0"
|
||||
Text="{Binding Value, StringFormat=N3, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
|
||||
Cursor="/Resources/aero_drag_ew.cur"
|
||||
Cursor="/Resources/Cursors/aero_drag_ew.cur"
|
||||
Foreground="{DynamicResource SecondaryAccentBrush}"
|
||||
MouseDown="InputMouseDown"
|
||||
MouseUp="InputMouseUp"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<Separator></Separator>
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Text="Stack trace" TextWrapping="Wrap" FontWeight="Bold" Margin="20 5 0 0"/>
|
||||
<avalonedit:TextEditor SyntaxHighlighting="C#"
|
||||
FontFamily="Consolas"
|
||||
FontFamily="Resources\Fonts\RobotoMono-Regular.ttf"
|
||||
FontSize="10pt"
|
||||
IsReadOnly="True"
|
||||
Document="{Binding Document}"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\logo-512.ico</ApplicationIcon>
|
||||
<ApplicationIcon>Resources\Images\Logo\logo-512.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent />
|
||||
@@ -54,60 +54,57 @@
|
||||
<SubType>Designer</SubType>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Resources\RobotoMono-Regular.ttf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" />
|
||||
<ProjectReference Include="..\Artemis.UI.Shared\Artemis.UI.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\logo-512.ico" />
|
||||
<Resource Include="Resources\logo-512.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\bow.svg" />
|
||||
<Resource Include="Resources\Fonts\RobotoMono-Regular.ttf" />
|
||||
<Resource Include="Resources\Images\Logo\logo-512.ico" />
|
||||
<Resource Include="Resources\Images\Logo\logo-512.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="FodyWeavers.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_rotate_tl.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_rotate_tl.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_rotate_tr.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_rotate_tr.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_rotate_bl.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_rotate_bl.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_rotate_br.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_rotate_br.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_crosshair.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_crosshair.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_crosshair_minus.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_crosshair_minus.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_crosshair_plus.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_crosshair_plus.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_pen_min.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_pen_min.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_pen_plus.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_pen_plus.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_fill.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_fill.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_drag.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_drag.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_drag_ew.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_drag_ew.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Resources\aero_rotate.cur" />
|
||||
<Resource Include="Resources\Cursors\aero_rotate.cur" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Castle.Core" Version="4.4.0" />
|
||||
@@ -280,7 +277,8 @@
|
||||
<Compile Remove="obj\x64\Debug\Screens\Module\ProfileEditor\LayerProperties\PropertyTree\PropertyInput\SKSizePropertyInputView.g.i.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="Resources\logo-512.ico" />
|
||||
<None Remove="Resources\Fonts\RobotoMono-Regular.ttf" />
|
||||
<None Remove="Resources\Images\Logo\logo-512.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
|
||||
@@ -119,48 +119,48 @@
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="aero_crosshair" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_crosshair.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_crosshair.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_crosshair_minus" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_crosshair_minus.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_crosshair_minus.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_crosshair_plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_crosshair_plus.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_crosshair_plus.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_drag" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_drag.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_drag.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_drag_ew" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_drag_ew.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_drag_ew.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_fill.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_fill.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_pen_min" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_pen_min.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_pen_min.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_pen_plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_pen_plus.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_pen_plus.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_rotate" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_rotate.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_rotate.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_rotate_bl" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_rotate_bl.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_rotate_bl.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_rotate_br" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_rotate_br.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_rotate_br.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_rotate_tl" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_rotate_tl.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_rotate_tl.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="aero_rotate_tr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\aero_rotate_tr.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\cursors\aero_rotate_tr.cur;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="bow" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\bow.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\images\logo\bow.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="RobotoMono_Regular" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\RobotoMono-Regular.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>..\resources\fonts\robotomono-regular.ttf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -35,7 +35,7 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Source="/Resources/logo-512.png" Stretch="Uniform" Width="100" Height="100" />
|
||||
<Image Source="/Resources/Images/Logo/logo-512.png" Stretch="Uniform" Width="100" Height="100" />
|
||||
<StackPanel Grid.Column="1" Margin="24 0 0 0" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource MaterialDesignHeadline4TextBlock}" TextWrapping="Wrap">Welcome to Artemis, RGB on steroids.</TextBlock>
|
||||
<Button Style="{StaticResource MaterialDesignFlatButton}"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
|
||||
namespace Artemis.UI.Screens.Home
|
||||
{
|
||||
@@ -9,8 +8,6 @@ namespace Artemis.UI.Screens.Home
|
||||
public HomeViewModel()
|
||||
{
|
||||
DisplayName = "Home";
|
||||
DisplayIcon = PackIconKind.Home;
|
||||
DisplayOrder = 1;
|
||||
}
|
||||
|
||||
public void OpenUrl(string url)
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Stylet;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens
|
||||
{
|
||||
public abstract class MainScreenViewModel : Screen
|
||||
{
|
||||
public int DisplayOrder { get; set; }
|
||||
public PackIconKind DisplayIcon { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
|
||||
+26
-2
@@ -9,6 +9,7 @@ using Artemis.Core.Models.Profile;
|
||||
using Artemis.Core.Models.Profile.LayerProperties;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.UI.Events;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree;
|
||||
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
|
||||
@@ -43,8 +44,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
PropertyTimeline = propertyTimelineVmFactory.Create(this);
|
||||
|
||||
PopulateProperties(_profileEditorService.SelectedProfileElement, null);
|
||||
_profileEditorService.ProfileElementSelected += (sender, args) => PopulateProperties(args.ProfileElement, args.PreviousProfileElement);
|
||||
_profileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged;
|
||||
}
|
||||
|
||||
public bool Playing { get; set; }
|
||||
@@ -70,11 +69,36 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
|
||||
public PropertyTreeViewModel PropertyTree { get; set; }
|
||||
public PropertyTimelineViewModel PropertyTimeline { get; set; }
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
_profileEditorService.ProfileElementSelected += ProfileEditorServiceOnProfileElementSelected;
|
||||
_profileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged;
|
||||
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
_profileEditorService.ProfileElementSelected -= ProfileEditorServiceOnProfileElementSelected;
|
||||
_profileEditorService.CurrentTimeChanged -= ProfileEditorServiceOnCurrentTimeChanged;
|
||||
|
||||
PropertyTree?.Dispose();
|
||||
PropertyTimeline?.Dispose();
|
||||
PropertyTree = null;
|
||||
PropertyTimeline = null;
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
protected override void OnDeactivate()
|
||||
{
|
||||
Pause();
|
||||
base.OnDeactivate();
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnProfileElementSelected(object? sender, ProfileElementEventArgs e)
|
||||
{
|
||||
PopulateProperties(e.ProfileElement, e.PreviousProfileElement);
|
||||
}
|
||||
|
||||
private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
+22
-4
@@ -1,13 +1,15 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Artemis.UI.Events;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
{
|
||||
public class PropertyTreeViewModel : PropertyChangedBase
|
||||
public class PropertyTreeViewModel : PropertyChangedBase, IDisposable
|
||||
{
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
|
||||
@@ -18,13 +20,19 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
LayerPropertiesViewModel = layerPropertiesViewModel;
|
||||
PropertyTreeItemViewModels = new BindableCollection<PropertyTreeItemViewModel>();
|
||||
|
||||
_profileEditorService.CurrentTimeChanged += (sender, args) => Update(false);
|
||||
_profileEditorService.SelectedProfileElementUpdated += (sender, args) => Update(true);
|
||||
_profileEditorService.CurrentTimeChanged += OnCurrentTimeChanged;
|
||||
_profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
|
||||
}
|
||||
|
||||
public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
|
||||
public BindableCollection<PropertyTreeItemViewModel> PropertyTreeItemViewModels { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_profileEditorService.CurrentTimeChanged -= OnCurrentTimeChanged;
|
||||
_profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated;
|
||||
}
|
||||
|
||||
public void AddLayerProperty(LayerPropertyViewModel layerPropertyViewModel)
|
||||
{
|
||||
// Add as a root VM
|
||||
@@ -76,5 +84,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
|
||||
var parent = ((Control) sender).Parent as UIElement;
|
||||
parent?.RaiseEvent(eventArg);
|
||||
}
|
||||
|
||||
private void OnCurrentTimeChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Update(false);
|
||||
}
|
||||
|
||||
private void OnSelectedProfileElementUpdated(object? sender, ProfileElementEventArgs e)
|
||||
{
|
||||
Update(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
-4
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Artemis.UI.Events;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Utilities;
|
||||
@@ -12,7 +12,7 @@ using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
{
|
||||
public class PropertyTimelineViewModel : PropertyChangedBase
|
||||
public class PropertyTimelineViewModel : PropertyChangedBase, IDisposable
|
||||
{
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly IPropertyTrackVmFactory _propertyTrackVmFactory;
|
||||
@@ -27,8 +27,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
LayerPropertiesViewModel = layerPropertiesViewModel;
|
||||
PropertyTrackViewModels = new BindableCollection<PropertyTrackViewModel>();
|
||||
|
||||
_profileEditorService.SelectedProfileElementUpdated += (sender, args) => Update();
|
||||
LayerPropertiesViewModel.PixelsPerSecondChanged += (sender, args) => UpdateKeyframePositions();
|
||||
_profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
|
||||
LayerPropertiesViewModel.PixelsPerSecondChanged += OnPixelsPerSecondChanged;
|
||||
|
||||
Execute.PostToUIThread(() => SelectionRectangle = new RectangleGeometry());
|
||||
}
|
||||
@@ -39,6 +39,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
public BindableCollection<PropertyTrackViewModel> PropertyTrackViewModels { get; set; }
|
||||
public RectangleGeometry SelectionRectangle { get; set; }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated;
|
||||
LayerPropertiesViewModel.PixelsPerSecondChanged -= OnPixelsPerSecondChanged;
|
||||
}
|
||||
|
||||
public void UpdateEndTime()
|
||||
{
|
||||
// End time is the last keyframe + 10 sec
|
||||
@@ -96,6 +102,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
||||
UpdateEndTime();
|
||||
}
|
||||
|
||||
private void OnSelectedProfileElementUpdated(object? sender, ProfileElementEventArgs e)
|
||||
{
|
||||
Update();
|
||||
}
|
||||
|
||||
private void OnPixelsPerSecondChanged(object? sender, EventArgs e)
|
||||
{
|
||||
UpdateKeyframePositions();
|
||||
}
|
||||
|
||||
private void CreateViewModels(LayerPropertyViewModel property)
|
||||
{
|
||||
PropertyTrackViewModels.Add(_propertyTrackVmFactory.Create(this, property));
|
||||
|
||||
@@ -47,8 +47,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
Profiles = new BindableCollection<Profile>();
|
||||
|
||||
Items.AddRange(viewModels);
|
||||
|
||||
module.ActiveProfileChanged += ModuleOnActiveProfileChanged;
|
||||
}
|
||||
|
||||
public ProfileModule Module { get; }
|
||||
@@ -124,6 +122,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
{
|
||||
LoadWorkspaceSettings();
|
||||
_profileEditorService.StopRegularRender();
|
||||
Module.ActiveProfileChanged += ModuleOnActiveProfileChanged;
|
||||
Task.Run(LoadProfiles);
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
@@ -132,6 +131,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
|
||||
{
|
||||
SaveWorkspaceSettings();
|
||||
_profileEditorService.ResumeRegularRender();
|
||||
Module.ActiveProfileChanged -= ModuleOnActiveProfileChanged;
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -52,14 +52,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
PanZoomViewModel = new PanZoomViewModel {LimitToZero = false};
|
||||
});
|
||||
|
||||
ApplySurfaceConfiguration(surfaceService.ActiveSurface);
|
||||
ApplySurfaceConfiguration(_surfaceService.ActiveSurface);
|
||||
ApplyActiveProfile();
|
||||
CreateUpdateTrigger();
|
||||
ActivateToolByIndex(0);
|
||||
|
||||
_profileEditorService.ProfileSelected += OnProfileSelected;
|
||||
_profileEditorService.ProfileElementSelected += OnProfileElementSelected;
|
||||
_profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
|
||||
eventAggregator.Subscribe(this);
|
||||
}
|
||||
|
||||
@@ -120,6 +117,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
PauseRenderingOnFocusLoss = _settingsService.GetSetting("ProfileEditor.PauseRenderingOnFocusLoss", true);
|
||||
|
||||
HighlightSelectedLayer.SettingChanged += HighlightSelectedLayerOnSettingChanged;
|
||||
_surfaceService.ActiveSurfaceConfigurationSelected += OnActiveSurfaceConfigurationSelected;
|
||||
_profileEditorService.ProfileSelected += OnProfileSelected;
|
||||
_profileEditorService.ProfileElementSelected += OnProfileElementSelected;
|
||||
_profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
|
||||
|
||||
_updateTrigger.Start();
|
||||
base.OnInitialActivate();
|
||||
@@ -127,6 +128,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
HighlightSelectedLayer.SettingChanged -= HighlightSelectedLayerOnSettingChanged;
|
||||
_surfaceService.ActiveSurfaceConfigurationSelected -= OnActiveSurfaceConfigurationSelected;
|
||||
_profileEditorService.ProfileSelected -= OnProfileSelected;
|
||||
_profileEditorService.ProfileElementSelected -= OnProfileElementSelected;
|
||||
_profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated;
|
||||
|
||||
HighlightSelectedLayer.Save();
|
||||
PauseRenderingOnFocusLoss.Save();
|
||||
|
||||
@@ -150,8 +157,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
|
||||
var targetFps = Math.Min(targetFpsSetting.Value, editorTargetFpsSetting.Value);
|
||||
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / targetFps};
|
||||
_updateTrigger.Update += UpdateLeds;
|
||||
|
||||
_surfaceService.ActiveSurfaceConfigurationSelected += OnActiveSurfaceConfigurationSelected;
|
||||
}
|
||||
|
||||
private void OnActiveSurfaceConfigurationSelected(object sender, SurfaceConfigurationEventArgs e)
|
||||
|
||||
+5
-5
@@ -9,25 +9,25 @@
|
||||
<!-- Render these first so that they are always behind the actual shape -->
|
||||
<Ellipse x:Name="RotateTopLeft"
|
||||
Fill="Transparent"
|
||||
Cursor="/Resources/aero_rotate.cur"
|
||||
Cursor="/Resources/Cursors/aero_rotate.cur"
|
||||
MouseDown="RotationOnMouseDown"
|
||||
MouseUp="RotationOnMouseUp"
|
||||
MouseMove="RotationOnMouseMove" />
|
||||
<Ellipse x:Name="RotateTopRight"
|
||||
Fill="Transparent"
|
||||
Cursor="/Resources/aero_rotate.cur"
|
||||
Cursor="/Resources/Cursors/aero_rotate.cur"
|
||||
MouseDown="RotationOnMouseDown"
|
||||
MouseUp="RotationOnMouseUp"
|
||||
MouseMove="RotationOnMouseMove" />
|
||||
<Ellipse x:Name="RotateBottomRight"
|
||||
Fill="Transparent"
|
||||
Cursor="/Resources/aero_rotate.cur"
|
||||
Cursor="/Resources/Cursors/aero_rotate.cur"
|
||||
MouseDown="RotationOnMouseDown"
|
||||
MouseUp="RotationOnMouseUp"
|
||||
MouseMove="RotationOnMouseMove" />
|
||||
<Ellipse x:Name="RotateBottomLeft"
|
||||
Fill="Transparent"
|
||||
Cursor="/Resources/aero_rotate.cur"
|
||||
Cursor="/Resources/Cursors/aero_rotate.cur"
|
||||
MouseDown="RotationOnMouseDown"
|
||||
MouseUp="RotationOnMouseUp"
|
||||
MouseMove="RotationOnMouseMove" />
|
||||
@@ -38,7 +38,7 @@
|
||||
Stroke="{DynamicResource PrimaryHueMidBrush}"
|
||||
StrokeThickness="{Binding OutlineThickness}"
|
||||
StrokeDashArray="2 2"
|
||||
Cursor="/Resources/aero_drag.cur"
|
||||
Cursor="/Resources/Cursors/aero_drag.cur"
|
||||
MouseDown="MoveOnMouseDown"
|
||||
MouseUp="MoveOnMouseUp"
|
||||
MouseMove="MoveOnMouseMove" />
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
|
||||
namespace Artemis.UI.Screens.News
|
||||
namespace Artemis.UI.Screens.News
|
||||
{
|
||||
public class NewsViewModel : MainScreenViewModel
|
||||
{
|
||||
public NewsViewModel()
|
||||
{
|
||||
DisplayName = "News";
|
||||
DisplayIcon = PackIconKind.Newspaper;
|
||||
DisplayOrder = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
xmlns:tb="http://www.hardcodet.net/taskbar"
|
||||
mc:Ignorable="d"
|
||||
FadeContentIfInactive="False"
|
||||
Icon="/Artemis.UI;component/Resources/logo-512.png"
|
||||
Icon="/Resources/Images/Logo/logo-512.png"
|
||||
Title="Artemis"
|
||||
TitleBarIcon="{StaticResource BowIcon}"
|
||||
Foreground="{DynamicResource MaterialDesignBody}"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="800"
|
||||
d:DataContext="{d:DesignInstance debug:DebugViewModel}"
|
||||
Icon="/Artemis.UI;component/Resources/logo-512.png">
|
||||
Icon="/Resources/Images/Logo/logo-512.png">
|
||||
<StackPanel Margin="10, 10, 10, 10">
|
||||
<TextBlock>
|
||||
In this window you can view the inner workings of Artemis.
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace Artemis.UI.Screens.Settings.Debug
|
||||
{
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
|
||||
@@ -15,7 +15,6 @@ using Artemis.UI.Screens.Settings.Tabs.Devices;
|
||||
using Artemis.UI.Screens.Settings.Tabs.Plugins;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
using Artemis.UI.Shared.Utilities;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Microsoft.Win32;
|
||||
using Ninject;
|
||||
using Serilog.Events;
|
||||
@@ -42,8 +41,6 @@ namespace Artemis.UI.Screens.Settings
|
||||
IDeviceSettingsVmFactory deviceSettingsVmFactory)
|
||||
{
|
||||
DisplayName = "Settings";
|
||||
DisplayIcon = PackIconKind.Settings;
|
||||
DisplayOrder = 5;
|
||||
|
||||
_kernel = kernel;
|
||||
_surfaceService = surfaceService;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
@@ -22,7 +23,7 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
_pluginService = pluginService;
|
||||
|
||||
DefaultSidebarItems = defaultSidebarItems;
|
||||
SidebarItemObjects = new Dictionary<INavigationItem, object>();
|
||||
SidebarModules = new Dictionary<INavigationItem, Core.Plugins.Abstract.Module>();
|
||||
SidebarItems = new BindableCollection<INavigationItem>();
|
||||
|
||||
SetupSidebar();
|
||||
@@ -32,22 +33,21 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
|
||||
public List<MainScreenViewModel> DefaultSidebarItems { get; set; }
|
||||
public BindableCollection<INavigationItem> SidebarItems { get; set; }
|
||||
public Dictionary<INavigationItem, object> SidebarItemObjects { get; set; }
|
||||
public Dictionary<INavigationItem, Core.Plugins.Abstract.Module> SidebarModules { get; set; }
|
||||
public IScreen SelectedItem { get; set; }
|
||||
|
||||
public void SetupSidebar()
|
||||
{
|
||||
SidebarItems.Clear();
|
||||
SidebarItemObjects.Clear();
|
||||
SidebarModules.Clear();
|
||||
|
||||
// Add all default sidebar items
|
||||
SidebarItems.Add(new DividerNavigationItem());
|
||||
foreach (var screen in DefaultSidebarItems.OrderBy(d => d.DisplayOrder))
|
||||
{
|
||||
var sidebarItem = new FirstLevelNavigationItem {Icon = screen.DisplayIcon, Label = screen.DisplayName};
|
||||
SidebarItems.Add(sidebarItem);
|
||||
SidebarItemObjects.Add(sidebarItem, screen);
|
||||
}
|
||||
SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Home, Label = "Home"});
|
||||
SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Newspaper, Label = "News"});
|
||||
SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.TestTube, Label = "Workshop"});
|
||||
SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Edit, Label = "Surface Editor"});
|
||||
SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Settings, Label = "Settings"});
|
||||
|
||||
// Add all activated modules
|
||||
SidebarItems.Add(new DividerNavigationItem());
|
||||
@@ -57,12 +57,37 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
AddModule(module);
|
||||
|
||||
// Select the top item, which will be one of the defaults
|
||||
SidebarItems[1].IsSelected = true;
|
||||
SelectedItem = (IScreen) SidebarItemObjects[SidebarItems[1]];
|
||||
Task.Run(() => SelectSidebarItem(SidebarItems[1]));
|
||||
}
|
||||
|
||||
private async Task SelectSidebarItem(INavigationItem sidebarItem)
|
||||
{
|
||||
if (SelectedItem != null)
|
||||
{
|
||||
var canClose = await SelectedItem.CanCloseAsync();
|
||||
if (!canClose)
|
||||
return;
|
||||
SelectedItem.Close();
|
||||
}
|
||||
|
||||
// A module was selected if the dictionary contains the selected item
|
||||
if (SidebarModules.ContainsKey(sidebarItem))
|
||||
{
|
||||
SelectedItem = _moduleVmFactory.Create(SidebarModules[sidebarItem]);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedItem = null;
|
||||
}
|
||||
|
||||
// TODO: Remove this bad boy, just testing
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
GC.Collect();
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedMember.Global - Called by view
|
||||
public void SelectItem(WillSelectNavigationItemEventArgs args)
|
||||
public async Task SelectItem(WillSelectNavigationItemEventArgs args)
|
||||
{
|
||||
if (args.NavigationItemToSelect == null)
|
||||
{
|
||||
@@ -70,19 +95,13 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
return;
|
||||
}
|
||||
|
||||
var sidebarItemObject = SidebarItemObjects[args.NavigationItemToSelect];
|
||||
// The default items are singleton screens, simply set it as the selected item
|
||||
if (sidebarItemObject is IScreen screen)
|
||||
SelectedItem = screen;
|
||||
// Modules have a VM that must be created, use a factory and set the result as the selected item
|
||||
else if (sidebarItemObject is Core.Plugins.Abstract.Module module)
|
||||
SelectedItem = _moduleVmFactory.Create(module);
|
||||
await SelectSidebarItem(args.NavigationItemToSelect);
|
||||
}
|
||||
|
||||
public void AddModule(Core.Plugins.Abstract.Module module)
|
||||
{
|
||||
// Ensure the module is not already in the list
|
||||
if (SidebarItemObjects.Any(io => io.Value == module))
|
||||
if (SidebarModules.Any(io => io.Value == module))
|
||||
return;
|
||||
|
||||
// Icon is provided as string to avoid having to reference MaterialDesignThemes
|
||||
@@ -91,18 +110,18 @@ namespace Artemis.UI.Screens.Sidebar
|
||||
iconEnum = PackIconKind.QuestionMarkCircle;
|
||||
var sidebarItem = new FirstLevelNavigationItem {Icon = iconEnum, Label = module.DisplayName};
|
||||
SidebarItems.Add(sidebarItem);
|
||||
SidebarItemObjects.Add(sidebarItem, module);
|
||||
SidebarModules.Add(sidebarItem, module);
|
||||
}
|
||||
|
||||
public void RemoveModule(Core.Plugins.Abstract.Module module)
|
||||
{
|
||||
// If not in the list there's nothing to do
|
||||
if (SidebarItemObjects.All(io => io.Value != module))
|
||||
if (SidebarModules.All(io => io.Value != module))
|
||||
return;
|
||||
|
||||
var existing = SidebarItemObjects.First(io => io.Value == module);
|
||||
var existing = SidebarModules.First(io => io.Value == module);
|
||||
SidebarItems.Remove(existing.Key);
|
||||
SidebarItemObjects.Remove(existing.Key);
|
||||
SidebarModules.Remove(existing.Key);
|
||||
}
|
||||
|
||||
#region Event handlers
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
using System.Windows.Input;
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core.Events;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using MaterialDesignExtensions.Controls;
|
||||
using Ninject;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.Splash
|
||||
@@ -16,20 +17,10 @@ namespace Artemis.UI.Screens.Splash
|
||||
_coreService = coreService;
|
||||
_pluginService = pluginService;
|
||||
Status = "Initializing Core";
|
||||
|
||||
ListenToEvents();
|
||||
}
|
||||
|
||||
public string Status { get; set; }
|
||||
|
||||
public void ListenToEvents()
|
||||
{
|
||||
_coreService.Initialized += (sender, args) => Execute.OnUIThread(() => RequestClose());
|
||||
_pluginService.CopyingBuildInPlugins += (sender, args) => Status = "Updating built-in plugins";
|
||||
_pluginService.PluginLoading += (sender, args) => Status = "Loading plugin: " + args.PluginInfo.Name;
|
||||
_pluginService.PluginLoaded += (sender, args) => Status = "Initializing UI";
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedMember.Global - Called from view
|
||||
public void MouseDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
@@ -37,5 +28,43 @@ namespace Artemis.UI.Screens.Splash
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
((MaterialWindow) View).DragMove();
|
||||
}
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
_coreService.Initialized += OnCoreServiceOnInitialized;
|
||||
_pluginService.CopyingBuildInPlugins += OnPluginServiceOnCopyingBuildInPlugins;
|
||||
_pluginService.PluginLoading += OnPluginServiceOnPluginLoading;
|
||||
_pluginService.PluginLoaded += OnPluginServiceOnPluginLoaded;
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
_coreService.Initialized -= OnCoreServiceOnInitialized;
|
||||
_pluginService.CopyingBuildInPlugins -= OnPluginServiceOnCopyingBuildInPlugins;
|
||||
_pluginService.PluginLoading -= OnPluginServiceOnPluginLoading;
|
||||
_pluginService.PluginLoaded -= OnPluginServiceOnPluginLoaded;
|
||||
base.OnClose();
|
||||
}
|
||||
|
||||
private void OnPluginServiceOnPluginLoaded(object? sender, PluginEventArgs args)
|
||||
{
|
||||
Status = "Initializing UI";
|
||||
}
|
||||
|
||||
private void OnPluginServiceOnPluginLoading(object? sender, PluginEventArgs args)
|
||||
{
|
||||
Status = "Loading plugin: " + args.PluginInfo.Name;
|
||||
}
|
||||
|
||||
private void OnPluginServiceOnCopyingBuildInPlugins(object? sender, EventArgs args)
|
||||
{
|
||||
Status = "Updating built-in plugins";
|
||||
}
|
||||
|
||||
private void OnCoreServiceOnInitialized(object? sender, EventArgs args)
|
||||
{
|
||||
Execute.OnUIThread(() => RequestClose());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ using Artemis.UI.Screens.Shared;
|
||||
using Artemis.UI.Screens.SurfaceEditor.Dialogs;
|
||||
using Artemis.UI.Screens.SurfaceEditor.Visualization;
|
||||
using Artemis.UI.Shared.Services.Interfaces;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.SurfaceEditor
|
||||
@@ -30,8 +29,6 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
||||
public SurfaceEditorViewModel(ISurfaceService surfaceService, IDialogService dialogService, ISettingsService settingsService, IDeviceService deviceService)
|
||||
{
|
||||
DisplayName = "Surface Editor";
|
||||
DisplayIcon = PackIconKind.Edit;
|
||||
DisplayOrder = 4;
|
||||
|
||||
Devices = new ObservableCollection<SurfaceDeviceViewModel>();
|
||||
SurfaceConfigurations = new ObservableCollection<ArtemisSurface>();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
Width="1"
|
||||
Visibility="Hidden">
|
||||
<tb:TaskbarIcon x:Name="TrayIcon"
|
||||
IconSource="/Resources/logo-512.ico"
|
||||
IconSource="/Resources/Images/Logo/logo-512.ico"
|
||||
MenuActivation="LeftOrRightClick"
|
||||
PopupActivation="DoubleClick"
|
||||
ToolTipText="Artemis"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Windows.Media;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop
|
||||
{
|
||||
@@ -8,8 +7,6 @@ namespace Artemis.UI.Screens.Workshop
|
||||
public WorkshopViewModel()
|
||||
{
|
||||
DisplayName = "Workshop";
|
||||
DisplayIcon = PackIconKind.TestTube;
|
||||
DisplayOrder = 3;
|
||||
}
|
||||
|
||||
public Color TestColor { get; set; }
|
||||
|
||||
Reference in new issue
Block a user