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

UI - Restructured resources directory

UI - Fixed a few memory leaks
This commit is contained in:
Robert 2020-02-24 21:15:21 +01:00
parent 8b95243a7c
commit 2b66ba656b
41 changed files with 215 additions and 123 deletions

View File

@ -23,7 +23,7 @@
Padding="1 0" Padding="1 0"
Margin="0 4 0 0" Margin="0 4 0 0"
Text="{Binding Value, StringFormat=N3, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" 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}" Foreground="{DynamicResource SecondaryAccentBrush}"
MouseDown="InputMouseDown" MouseDown="InputMouseDown"
MouseUp="InputMouseUp" MouseUp="InputMouseUp"

View File

@ -17,7 +17,7 @@
<Separator></Separator> <Separator></Separator>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Text="Stack trace" TextWrapping="Wrap" FontWeight="Bold" Margin="20 5 0 0"/> <TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Text="Stack trace" TextWrapping="Wrap" FontWeight="Bold" Margin="20 5 0 0"/>
<avalonedit:TextEditor SyntaxHighlighting="C#" <avalonedit:TextEditor SyntaxHighlighting="C#"
FontFamily="Consolas" FontFamily="Resources\Fonts\RobotoMono-Regular.ttf"
FontSize="10pt" FontSize="10pt"
IsReadOnly="True" IsReadOnly="True"
Document="{Binding Document}" Document="{Binding Document}"

View File

@ -26,7 +26,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>Resources\logo-512.ico</ApplicationIcon> <ApplicationIcon>Resources\Images\Logo\logo-512.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<PostBuildEvent /> <PostBuildEvent />
@ -54,60 +54,57 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="Resources\RobotoMono-Regular.ttf" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" /> <ProjectReference Include="..\Artemis.Core\Artemis.Core.csproj" />
<ProjectReference Include="..\Artemis.UI.Shared\Artemis.UI.Shared.csproj" /> <ProjectReference Include="..\Artemis.UI.Shared\Artemis.UI.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\logo-512.ico" /> <Resource Include="Resources\Fonts\RobotoMono-Regular.ttf" />
<Resource Include="Resources\logo-512.png" /> <Resource Include="Resources\Images\Logo\logo-512.ico" />
</ItemGroup> <Resource Include="Resources\Images\Logo\logo-512.png" />
<ItemGroup>
<None Include="Resources\bow.svg" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="FodyWeavers.xml" /> <Resource Include="FodyWeavers.xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_rotate_tl.cur" /> <Resource Include="Resources\Cursors\aero_rotate_tl.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_rotate_tr.cur" /> <Resource Include="Resources\Cursors\aero_rotate_tr.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_rotate_bl.cur" /> <Resource Include="Resources\Cursors\aero_rotate_bl.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_rotate_br.cur" /> <Resource Include="Resources\Cursors\aero_rotate_br.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_crosshair.cur" /> <Resource Include="Resources\Cursors\aero_crosshair.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_crosshair_minus.cur" /> <Resource Include="Resources\Cursors\aero_crosshair_minus.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_crosshair_plus.cur" /> <Resource Include="Resources\Cursors\aero_crosshair_plus.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_pen_min.cur" /> <Resource Include="Resources\Cursors\aero_pen_min.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_pen_plus.cur" /> <Resource Include="Resources\Cursors\aero_pen_plus.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_fill.cur" /> <Resource Include="Resources\Cursors\aero_fill.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_drag.cur" /> <Resource Include="Resources\Cursors\aero_drag.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_drag_ew.cur" /> <Resource Include="Resources\Cursors\aero_drag_ew.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Resource Include="Resources\aero_rotate.cur" /> <Resource Include="Resources\Cursors\aero_rotate.cur" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.0" /> <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" /> <Compile Remove="obj\x64\Debug\Screens\Module\ProfileEditor\LayerProperties\PropertyTree\PropertyInput\SKSizePropertyInputView.g.i.cs" />
</ItemGroup> </ItemGroup>
<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>
<ItemGroup> <ItemGroup>
<Compile Update="Properties\Resources.Designer.cs"> <Compile Update="Properties\Resources.Designer.cs">

View File

@ -119,48 +119,48 @@
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <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"> <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>
<data name="aero_crosshair_minus" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_crosshair_plus" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_drag" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_drag_ew" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_fill" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_pen_min" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_pen_plus" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_rotate" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_rotate_bl" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_rotate_br" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_rotate_tl" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="aero_rotate_tr" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="bow" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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>
<data name="RobotoMono_Regular" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> </data>
</root> </root>

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -35,7 +35,7 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </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"> <StackPanel Grid.Column="1" Margin="24 0 0 0" VerticalAlignment="Center">
<TextBlock Style="{StaticResource MaterialDesignHeadline4TextBlock}" TextWrapping="Wrap">Welcome to Artemis, RGB on steroids.</TextBlock> <TextBlock Style="{StaticResource MaterialDesignHeadline4TextBlock}" TextWrapping="Wrap">Welcome to Artemis, RGB on steroids.</TextBlock>
<Button Style="{StaticResource MaterialDesignFlatButton}" <Button Style="{StaticResource MaterialDesignFlatButton}"

View File

@ -1,6 +1,5 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using MaterialDesignThemes.Wpf;
namespace Artemis.UI.Screens.Home namespace Artemis.UI.Screens.Home
{ {
@ -9,8 +8,6 @@ namespace Artemis.UI.Screens.Home
public HomeViewModel() public HomeViewModel()
{ {
DisplayName = "Home"; DisplayName = "Home";
DisplayIcon = PackIconKind.Home;
DisplayOrder = 1;
} }
public void OpenUrl(string url) public void OpenUrl(string url)

View File

@ -1,11 +1,8 @@
using MaterialDesignThemes.Wpf; using Stylet;
using Stylet;
namespace Artemis.UI.Screens namespace Artemis.UI.Screens
{ {
public abstract class MainScreenViewModel : Screen public abstract class MainScreenViewModel : Screen
{ {
public int DisplayOrder { get; set; }
public PackIconKind DisplayIcon { get; set; }
} }
} }

View File

@ -1,4 +1,5 @@
using System.Linq; using System;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Abstract;
using Artemis.UI.Ninject.Factories; using Artemis.UI.Ninject.Factories;

View File

@ -9,6 +9,7 @@ using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerProperties; using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.Core.Services; using Artemis.Core.Services;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;
using Artemis.UI.Events;
using Artemis.UI.Ninject.Factories; using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree; using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline; using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
@ -43,8 +44,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
PropertyTimeline = propertyTimelineVmFactory.Create(this); PropertyTimeline = propertyTimelineVmFactory.Create(this);
PopulateProperties(_profileEditorService.SelectedProfileElement, null); PopulateProperties(_profileEditorService.SelectedProfileElement, null);
_profileEditorService.ProfileElementSelected += (sender, args) => PopulateProperties(args.ProfileElement, args.PreviousProfileElement);
_profileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged;
} }
public bool Playing { get; set; } public bool Playing { get; set; }
@ -70,11 +69,36 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
public PropertyTreeViewModel PropertyTree { get; set; } public PropertyTreeViewModel PropertyTree { get; set; }
public PropertyTimelineViewModel PropertyTimeline { 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() protected override void OnDeactivate()
{ {
Pause(); Pause();
base.OnDeactivate(); base.OnDeactivate();
} }
private void ProfileEditorServiceOnProfileElementSelected(object? sender, ProfileElementEventArgs e)
{
PopulateProperties(e.ProfileElement, e.PreviousProfileElement);
}
private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e) private void ProfileEditorServiceOnCurrentTimeChanged(object sender, EventArgs e)
{ {

View File

@ -1,13 +1,15 @@
using System.Linq; using System;
using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using Artemis.UI.Events;
using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Interfaces;
using Stylet; using Stylet;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
{ {
public class PropertyTreeViewModel : PropertyChangedBase public class PropertyTreeViewModel : PropertyChangedBase, IDisposable
{ {
private readonly IProfileEditorService _profileEditorService; private readonly IProfileEditorService _profileEditorService;
@ -18,13 +20,19 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
LayerPropertiesViewModel = layerPropertiesViewModel; LayerPropertiesViewModel = layerPropertiesViewModel;
PropertyTreeItemViewModels = new BindableCollection<PropertyTreeItemViewModel>(); PropertyTreeItemViewModels = new BindableCollection<PropertyTreeItemViewModel>();
_profileEditorService.CurrentTimeChanged += (sender, args) => Update(false); _profileEditorService.CurrentTimeChanged += OnCurrentTimeChanged;
_profileEditorService.SelectedProfileElementUpdated += (sender, args) => Update(true); _profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
} }
public LayerPropertiesViewModel LayerPropertiesViewModel { get; } public LayerPropertiesViewModel LayerPropertiesViewModel { get; }
public BindableCollection<PropertyTreeItemViewModel> PropertyTreeItemViewModels { get; set; } public BindableCollection<PropertyTreeItemViewModel> PropertyTreeItemViewModels { get; set; }
public void Dispose()
{
_profileEditorService.CurrentTimeChanged -= OnCurrentTimeChanged;
_profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated;
}
public void AddLayerProperty(LayerPropertyViewModel layerPropertyViewModel) public void AddLayerProperty(LayerPropertyViewModel layerPropertyViewModel)
{ {
// Add as a root VM // Add as a root VM
@ -76,5 +84,15 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree
var parent = ((Control) sender).Parent as UIElement; var parent = ((Control) sender).Parent as UIElement;
parent?.RaiseEvent(eventArg); parent?.RaiseEvent(eventArg);
} }
private void OnCurrentTimeChanged(object? sender, EventArgs e)
{
Update(false);
}
private void OnSelectedProfileElementUpdated(object? sender, ProfileElementEventArgs e)
{
Update(true);
}
} }
} }

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Shapes; using Artemis.UI.Events;
using Artemis.UI.Ninject.Factories; using Artemis.UI.Ninject.Factories;
using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Interfaces;
using Artemis.UI.Utilities; using Artemis.UI.Utilities;
@ -12,7 +12,7 @@ using Stylet;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
{ {
public class PropertyTimelineViewModel : PropertyChangedBase public class PropertyTimelineViewModel : PropertyChangedBase, IDisposable
{ {
private readonly IProfileEditorService _profileEditorService; private readonly IProfileEditorService _profileEditorService;
private readonly IPropertyTrackVmFactory _propertyTrackVmFactory; private readonly IPropertyTrackVmFactory _propertyTrackVmFactory;
@ -27,8 +27,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
LayerPropertiesViewModel = layerPropertiesViewModel; LayerPropertiesViewModel = layerPropertiesViewModel;
PropertyTrackViewModels = new BindableCollection<PropertyTrackViewModel>(); PropertyTrackViewModels = new BindableCollection<PropertyTrackViewModel>();
_profileEditorService.SelectedProfileElementUpdated += (sender, args) => Update(); _profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
LayerPropertiesViewModel.PixelsPerSecondChanged += (sender, args) => UpdateKeyframePositions(); LayerPropertiesViewModel.PixelsPerSecondChanged += OnPixelsPerSecondChanged;
Execute.PostToUIThread(() => SelectionRectangle = new RectangleGeometry()); Execute.PostToUIThread(() => SelectionRectangle = new RectangleGeometry());
} }
@ -39,6 +39,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
public BindableCollection<PropertyTrackViewModel> PropertyTrackViewModels { get; set; } public BindableCollection<PropertyTrackViewModel> PropertyTrackViewModels { get; set; }
public RectangleGeometry SelectionRectangle { get; set; } public RectangleGeometry SelectionRectangle { get; set; }
public void Dispose()
{
_profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated;
LayerPropertiesViewModel.PixelsPerSecondChanged -= OnPixelsPerSecondChanged;
}
public void UpdateEndTime() public void UpdateEndTime()
{ {
// End time is the last keyframe + 10 sec // End time is the last keyframe + 10 sec
@ -96,6 +102,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
UpdateEndTime(); UpdateEndTime();
} }
private void OnSelectedProfileElementUpdated(object? sender, ProfileElementEventArgs e)
{
Update();
}
private void OnPixelsPerSecondChanged(object? sender, EventArgs e)
{
UpdateKeyframePositions();
}
private void CreateViewModels(LayerPropertyViewModel property) private void CreateViewModels(LayerPropertyViewModel property)
{ {
PropertyTrackViewModels.Add(_propertyTrackVmFactory.Create(this, property)); PropertyTrackViewModels.Add(_propertyTrackVmFactory.Create(this, property));

View File

@ -47,8 +47,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
Profiles = new BindableCollection<Profile>(); Profiles = new BindableCollection<Profile>();
Items.AddRange(viewModels); Items.AddRange(viewModels);
module.ActiveProfileChanged += ModuleOnActiveProfileChanged;
} }
public ProfileModule Module { get; } public ProfileModule Module { get; }
@ -124,6 +122,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
{ {
LoadWorkspaceSettings(); LoadWorkspaceSettings();
_profileEditorService.StopRegularRender(); _profileEditorService.StopRegularRender();
Module.ActiveProfileChanged += ModuleOnActiveProfileChanged;
Task.Run(LoadProfiles); Task.Run(LoadProfiles);
base.OnInitialActivate(); base.OnInitialActivate();
} }
@ -132,6 +131,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor
{ {
SaveWorkspaceSettings(); SaveWorkspaceSettings();
_profileEditorService.ResumeRegularRender(); _profileEditorService.ResumeRegularRender();
Module.ActiveProfileChanged -= ModuleOnActiveProfileChanged;
base.OnClose(); base.OnClose();
} }

View File

@ -52,14 +52,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
PanZoomViewModel = new PanZoomViewModel {LimitToZero = false}; PanZoomViewModel = new PanZoomViewModel {LimitToZero = false};
}); });
ApplySurfaceConfiguration(surfaceService.ActiveSurface); ApplySurfaceConfiguration(_surfaceService.ActiveSurface);
ApplyActiveProfile(); ApplyActiveProfile();
CreateUpdateTrigger(); CreateUpdateTrigger();
ActivateToolByIndex(0); ActivateToolByIndex(0);
_profileEditorService.ProfileSelected += OnProfileSelected;
_profileEditorService.ProfileElementSelected += OnProfileElementSelected;
_profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
eventAggregator.Subscribe(this); eventAggregator.Subscribe(this);
} }
@ -120,6 +117,10 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
PauseRenderingOnFocusLoss = _settingsService.GetSetting("ProfileEditor.PauseRenderingOnFocusLoss", true); PauseRenderingOnFocusLoss = _settingsService.GetSetting("ProfileEditor.PauseRenderingOnFocusLoss", true);
HighlightSelectedLayer.SettingChanged += HighlightSelectedLayerOnSettingChanged; HighlightSelectedLayer.SettingChanged += HighlightSelectedLayerOnSettingChanged;
_surfaceService.ActiveSurfaceConfigurationSelected += OnActiveSurfaceConfigurationSelected;
_profileEditorService.ProfileSelected += OnProfileSelected;
_profileEditorService.ProfileElementSelected += OnProfileElementSelected;
_profileEditorService.SelectedProfileElementUpdated += OnSelectedProfileElementUpdated;
_updateTrigger.Start(); _updateTrigger.Start();
base.OnInitialActivate(); base.OnInitialActivate();
@ -127,6 +128,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
protected override void OnClose() protected override void OnClose()
{ {
HighlightSelectedLayer.SettingChanged -= HighlightSelectedLayerOnSettingChanged;
_surfaceService.ActiveSurfaceConfigurationSelected -= OnActiveSurfaceConfigurationSelected;
_profileEditorService.ProfileSelected -= OnProfileSelected;
_profileEditorService.ProfileElementSelected -= OnProfileElementSelected;
_profileEditorService.SelectedProfileElementUpdated -= OnSelectedProfileElementUpdated;
HighlightSelectedLayer.Save(); HighlightSelectedLayer.Save();
PauseRenderingOnFocusLoss.Save(); PauseRenderingOnFocusLoss.Save();
@ -150,8 +157,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
var targetFps = Math.Min(targetFpsSetting.Value, editorTargetFpsSetting.Value); var targetFps = Math.Min(targetFpsSetting.Value, editorTargetFpsSetting.Value);
_updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / targetFps}; _updateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / targetFps};
_updateTrigger.Update += UpdateLeds; _updateTrigger.Update += UpdateLeds;
_surfaceService.ActiveSurfaceConfigurationSelected += OnActiveSurfaceConfigurationSelected;
} }
private void OnActiveSurfaceConfigurationSelected(object sender, SurfaceConfigurationEventArgs e) private void OnActiveSurfaceConfigurationSelected(object sender, SurfaceConfigurationEventArgs e)

View File

@ -9,25 +9,25 @@
<!-- Render these first so that they are always behind the actual shape --> <!-- Render these first so that they are always behind the actual shape -->
<Ellipse x:Name="RotateTopLeft" <Ellipse x:Name="RotateTopLeft"
Fill="Transparent" Fill="Transparent"
Cursor="/Resources/aero_rotate.cur" Cursor="/Resources/Cursors/aero_rotate.cur"
MouseDown="RotationOnMouseDown" MouseDown="RotationOnMouseDown"
MouseUp="RotationOnMouseUp" MouseUp="RotationOnMouseUp"
MouseMove="RotationOnMouseMove" /> MouseMove="RotationOnMouseMove" />
<Ellipse x:Name="RotateTopRight" <Ellipse x:Name="RotateTopRight"
Fill="Transparent" Fill="Transparent"
Cursor="/Resources/aero_rotate.cur" Cursor="/Resources/Cursors/aero_rotate.cur"
MouseDown="RotationOnMouseDown" MouseDown="RotationOnMouseDown"
MouseUp="RotationOnMouseUp" MouseUp="RotationOnMouseUp"
MouseMove="RotationOnMouseMove" /> MouseMove="RotationOnMouseMove" />
<Ellipse x:Name="RotateBottomRight" <Ellipse x:Name="RotateBottomRight"
Fill="Transparent" Fill="Transparent"
Cursor="/Resources/aero_rotate.cur" Cursor="/Resources/Cursors/aero_rotate.cur"
MouseDown="RotationOnMouseDown" MouseDown="RotationOnMouseDown"
MouseUp="RotationOnMouseUp" MouseUp="RotationOnMouseUp"
MouseMove="RotationOnMouseMove" /> MouseMove="RotationOnMouseMove" />
<Ellipse x:Name="RotateBottomLeft" <Ellipse x:Name="RotateBottomLeft"
Fill="Transparent" Fill="Transparent"
Cursor="/Resources/aero_rotate.cur" Cursor="/Resources/Cursors/aero_rotate.cur"
MouseDown="RotationOnMouseDown" MouseDown="RotationOnMouseDown"
MouseUp="RotationOnMouseUp" MouseUp="RotationOnMouseUp"
MouseMove="RotationOnMouseMove" /> MouseMove="RotationOnMouseMove" />
@ -38,7 +38,7 @@
Stroke="{DynamicResource PrimaryHueMidBrush}" Stroke="{DynamicResource PrimaryHueMidBrush}"
StrokeThickness="{Binding OutlineThickness}" StrokeThickness="{Binding OutlineThickness}"
StrokeDashArray="2 2" StrokeDashArray="2 2"
Cursor="/Resources/aero_drag.cur" Cursor="/Resources/Cursors/aero_drag.cur"
MouseDown="MoveOnMouseDown" MouseDown="MoveOnMouseDown"
MouseUp="MoveOnMouseUp" MouseUp="MoveOnMouseUp"
MouseMove="MoveOnMouseMove" /> MouseMove="MoveOnMouseMove" />

View File

@ -1,14 +1,10 @@
using MaterialDesignThemes.Wpf; namespace Artemis.UI.Screens.News
namespace Artemis.UI.Screens.News
{ {
public class NewsViewModel : MainScreenViewModel public class NewsViewModel : MainScreenViewModel
{ {
public NewsViewModel() public NewsViewModel()
{ {
DisplayName = "News"; DisplayName = "News";
DisplayIcon = PackIconKind.Newspaper;
DisplayOrder = 2;
} }
} }
} }

View File

@ -10,7 +10,7 @@
xmlns:tb="http://www.hardcodet.net/taskbar" xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d" mc:Ignorable="d"
FadeContentIfInactive="False" FadeContentIfInactive="False"
Icon="/Artemis.UI;component/Resources/logo-512.png" Icon="/Resources/Images/Logo/logo-512.png"
Title="Artemis" Title="Artemis"
TitleBarIcon="{StaticResource BowIcon}" TitleBarIcon="{StaticResource BowIcon}"
Foreground="{DynamicResource MaterialDesignBody}" Foreground="{DynamicResource MaterialDesignBody}"

View File

@ -17,7 +17,7 @@
d:DesignHeight="800" d:DesignHeight="800"
d:DesignWidth="800" d:DesignWidth="800"
d:DataContext="{d:DesignInstance debug:DebugViewModel}" 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"> <StackPanel Margin="10, 10, 10, 10">
<TextBlock> <TextBlock>
In this window you can view the inner workings of Artemis. In this window you can view the inner workings of Artemis.

View File

@ -34,6 +34,7 @@ namespace Artemis.UI.Screens.Settings.Debug
{ {
GC.Collect(); GC.Collect();
GC.WaitForPendingFinalizers(); GC.WaitForPendingFinalizers();
GC.Collect();
} }
protected override void OnInitialActivate() protected override void OnInitialActivate()

View File

@ -15,7 +15,6 @@ using Artemis.UI.Screens.Settings.Tabs.Devices;
using Artemis.UI.Screens.Settings.Tabs.Plugins; using Artemis.UI.Screens.Settings.Tabs.Plugins;
using Artemis.UI.Shared.Services.Interfaces; using Artemis.UI.Shared.Services.Interfaces;
using Artemis.UI.Shared.Utilities; using Artemis.UI.Shared.Utilities;
using MaterialDesignThemes.Wpf;
using Microsoft.Win32; using Microsoft.Win32;
using Ninject; using Ninject;
using Serilog.Events; using Serilog.Events;
@ -42,8 +41,6 @@ namespace Artemis.UI.Screens.Settings
IDeviceSettingsVmFactory deviceSettingsVmFactory) IDeviceSettingsVmFactory deviceSettingsVmFactory)
{ {
DisplayName = "Settings"; DisplayName = "Settings";
DisplayIcon = PackIconKind.Settings;
DisplayOrder = 5;
_kernel = kernel; _kernel = kernel;
_surfaceService = surfaceService; _surfaceService = surfaceService;

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using Artemis.Core.Events; using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;
using Artemis.UI.Ninject.Factories; using Artemis.UI.Ninject.Factories;
@ -22,7 +23,7 @@ namespace Artemis.UI.Screens.Sidebar
_pluginService = pluginService; _pluginService = pluginService;
DefaultSidebarItems = defaultSidebarItems; DefaultSidebarItems = defaultSidebarItems;
SidebarItemObjects = new Dictionary<INavigationItem, object>(); SidebarModules = new Dictionary<INavigationItem, Core.Plugins.Abstract.Module>();
SidebarItems = new BindableCollection<INavigationItem>(); SidebarItems = new BindableCollection<INavigationItem>();
SetupSidebar(); SetupSidebar();
@ -32,22 +33,21 @@ namespace Artemis.UI.Screens.Sidebar
public List<MainScreenViewModel> DefaultSidebarItems { get; set; } public List<MainScreenViewModel> DefaultSidebarItems { get; set; }
public BindableCollection<INavigationItem> SidebarItems { 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 IScreen SelectedItem { get; set; }
public void SetupSidebar() public void SetupSidebar()
{ {
SidebarItems.Clear(); SidebarItems.Clear();
SidebarItemObjects.Clear(); SidebarModules.Clear();
// Add all default sidebar items // Add all default sidebar items
SidebarItems.Add(new DividerNavigationItem()); SidebarItems.Add(new DividerNavigationItem());
foreach (var screen in DefaultSidebarItems.OrderBy(d => d.DisplayOrder)) SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Home, Label = "Home"});
{ SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Newspaper, Label = "News"});
var sidebarItem = new FirstLevelNavigationItem {Icon = screen.DisplayIcon, Label = screen.DisplayName}; SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.TestTube, Label = "Workshop"});
SidebarItems.Add(sidebarItem); SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Edit, Label = "Surface Editor"});
SidebarItemObjects.Add(sidebarItem, screen); SidebarItems.Add(new FirstLevelNavigationItem {Icon = PackIconKind.Settings, Label = "Settings"});
}
// Add all activated modules // Add all activated modules
SidebarItems.Add(new DividerNavigationItem()); SidebarItems.Add(new DividerNavigationItem());
@ -57,12 +57,37 @@ namespace Artemis.UI.Screens.Sidebar
AddModule(module); AddModule(module);
// Select the top item, which will be one of the defaults // Select the top item, which will be one of the defaults
SidebarItems[1].IsSelected = true; Task.Run(() => SelectSidebarItem(SidebarItems[1]));
SelectedItem = (IScreen) SidebarItemObjects[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 // ReSharper disable once UnusedMember.Global - Called by view
public void SelectItem(WillSelectNavigationItemEventArgs args) public async Task SelectItem(WillSelectNavigationItemEventArgs args)
{ {
if (args.NavigationItemToSelect == null) if (args.NavigationItemToSelect == null)
{ {
@ -70,19 +95,13 @@ namespace Artemis.UI.Screens.Sidebar
return; return;
} }
var sidebarItemObject = SidebarItemObjects[args.NavigationItemToSelect]; await SelectSidebarItem(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);
} }
public void AddModule(Core.Plugins.Abstract.Module module) public void AddModule(Core.Plugins.Abstract.Module module)
{ {
// Ensure the module is not already in the list // Ensure the module is not already in the list
if (SidebarItemObjects.Any(io => io.Value == module)) if (SidebarModules.Any(io => io.Value == module))
return; return;
// Icon is provided as string to avoid having to reference MaterialDesignThemes // Icon is provided as string to avoid having to reference MaterialDesignThemes
@ -91,18 +110,18 @@ namespace Artemis.UI.Screens.Sidebar
iconEnum = PackIconKind.QuestionMarkCircle; iconEnum = PackIconKind.QuestionMarkCircle;
var sidebarItem = new FirstLevelNavigationItem {Icon = iconEnum, Label = module.DisplayName}; var sidebarItem = new FirstLevelNavigationItem {Icon = iconEnum, Label = module.DisplayName};
SidebarItems.Add(sidebarItem); SidebarItems.Add(sidebarItem);
SidebarItemObjects.Add(sidebarItem, module); SidebarModules.Add(sidebarItem, module);
} }
public void RemoveModule(Core.Plugins.Abstract.Module module) public void RemoveModule(Core.Plugins.Abstract.Module module)
{ {
// If not in the list there's nothing to do // 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; return;
var existing = SidebarItemObjects.First(io => io.Value == module); var existing = SidebarModules.First(io => io.Value == module);
SidebarItems.Remove(existing.Key); SidebarItems.Remove(existing.Key);
SidebarItemObjects.Remove(existing.Key); SidebarModules.Remove(existing.Key);
} }
#region Event handlers #region Event handlers

View File

@ -1,7 +1,8 @@
using System.Windows.Input; using System;
using System.Windows.Input;
using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Interfaces;
using MaterialDesignExtensions.Controls; using MaterialDesignExtensions.Controls;
using Ninject;
using Stylet; using Stylet;
namespace Artemis.UI.Screens.Splash namespace Artemis.UI.Screens.Splash
@ -16,20 +17,10 @@ namespace Artemis.UI.Screens.Splash
_coreService = coreService; _coreService = coreService;
_pluginService = pluginService; _pluginService = pluginService;
Status = "Initializing Core"; Status = "Initializing Core";
ListenToEvents();
} }
public string Status { get; set; } 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 // ReSharper disable once UnusedMember.Global - Called from view
public void MouseDown(object sender, MouseButtonEventArgs e) public void MouseDown(object sender, MouseButtonEventArgs e)
{ {
@ -37,5 +28,43 @@ namespace Artemis.UI.Screens.Splash
if (e.ChangedButton == MouseButton.Left) if (e.ChangedButton == MouseButton.Left)
((MaterialWindow) View).DragMove(); ((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());
}
} }
} }

View File

@ -15,7 +15,6 @@ using Artemis.UI.Screens.Shared;
using Artemis.UI.Screens.SurfaceEditor.Dialogs; using Artemis.UI.Screens.SurfaceEditor.Dialogs;
using Artemis.UI.Screens.SurfaceEditor.Visualization; using Artemis.UI.Screens.SurfaceEditor.Visualization;
using Artemis.UI.Shared.Services.Interfaces; using Artemis.UI.Shared.Services.Interfaces;
using MaterialDesignThemes.Wpf;
using Stylet; using Stylet;
namespace Artemis.UI.Screens.SurfaceEditor namespace Artemis.UI.Screens.SurfaceEditor
@ -30,8 +29,6 @@ namespace Artemis.UI.Screens.SurfaceEditor
public SurfaceEditorViewModel(ISurfaceService surfaceService, IDialogService dialogService, ISettingsService settingsService, IDeviceService deviceService) public SurfaceEditorViewModel(ISurfaceService surfaceService, IDialogService dialogService, ISettingsService settingsService, IDeviceService deviceService)
{ {
DisplayName = "Surface Editor"; DisplayName = "Surface Editor";
DisplayIcon = PackIconKind.Edit;
DisplayOrder = 4;
Devices = new ObservableCollection<SurfaceDeviceViewModel>(); Devices = new ObservableCollection<SurfaceDeviceViewModel>();
SurfaceConfigurations = new ObservableCollection<ArtemisSurface>(); SurfaceConfigurations = new ObservableCollection<ArtemisSurface>();

View File

@ -13,7 +13,7 @@
Width="1" Width="1"
Visibility="Hidden"> Visibility="Hidden">
<tb:TaskbarIcon x:Name="TrayIcon" <tb:TaskbarIcon x:Name="TrayIcon"
IconSource="/Resources/logo-512.ico" IconSource="/Resources/Images/Logo/logo-512.ico"
MenuActivation="LeftOrRightClick" MenuActivation="LeftOrRightClick"
PopupActivation="DoubleClick" PopupActivation="DoubleClick"
ToolTipText="Artemis" ToolTipText="Artemis"

View File

@ -1,5 +1,4 @@
using System.Windows.Media; using System.Windows.Media;
using MaterialDesignThemes.Wpf;
namespace Artemis.UI.Screens.Workshop namespace Artemis.UI.Screens.Workshop
{ {
@ -8,8 +7,6 @@ namespace Artemis.UI.Screens.Workshop
public WorkshopViewModel() public WorkshopViewModel()
{ {
DisplayName = "Workshop"; DisplayName = "Workshop";
DisplayIcon = PackIconKind.TestTube;
DisplayOrder = 3;
} }
public Color TestColor { get; set; } public Color TestColor { get; set; }