diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index f4e4d85f2..daffe59a4 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -35,7 +35,7 @@ - + diff --git a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj index be2074278..9607a10d8 100644 --- a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj +++ b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj @@ -16,11 +16,11 @@ - - + + - - + + diff --git a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj index 13707476b..e674a2ad6 100644 --- a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj +++ b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj @@ -15,11 +15,11 @@ - - + + - - + + diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 10d2a3f16..4c5b91ce8 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -10,13 +10,13 @@ - + - - - + + + - + diff --git a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs index e403d0c93..6e174235d 100644 --- a/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ArtemisIcon.axaml.cs @@ -64,7 +64,7 @@ public partial class ArtemisIcon : UserControl Background = TextElement.GetForeground(this), VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, - OpacityMask = new ImageBrush(new Bitmap(iconString)) {BitmapInterpolationMode = BitmapInterpolationMode.MediumQuality} + OpacityMask = new ImageBrush(new Bitmap(iconString)) }; } else diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index b93053583..8541d98a6 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -67,8 +67,7 @@ public class DeviceVisualizer : Control drawingContext.DrawImage( _deviceImage, new Rect(_deviceImage.Size), - new Rect(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height), - RenderOptions.GetBitmapInterpolationMode(this) + new Rect(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height) ); if (!ShowColors) @@ -306,8 +305,8 @@ public class DeviceVisualizer : Control using DrawingContext context = renderTargetBitmap.CreateDrawingContext(); using Bitmap bitmap = new(device.Layout.Image.LocalPath); - context.DrawImage(bitmap, new Rect(bitmap.Size), new Rect(renderTargetBitmap.Size), BitmapInterpolationMode.HighQuality); - + + context.DrawImage(bitmap, new Rect(bitmap.Size), new Rect(renderTargetBitmap.Size)); lock (_deviceVisualizerLeds) { foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds) diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs index 5164d5844..29e219fb9 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs @@ -49,8 +49,7 @@ internal class DeviceVisualizerLed drawingContext.DrawImage( bitmap, new Rect(bitmap.Size), - new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, Led.RgbLed.Size.Width * scale, Led.RgbLed.Size.Height * scale), - BitmapInterpolationMode.HighQuality + new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, Led.RgbLed.Size.Width * scale, Led.RgbLed.Size.Height * scale) ); } catch diff --git a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs index 4dd0711ba..0e8b9adcb 100644 --- a/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml.cs @@ -75,7 +75,7 @@ public partial class ProfileConfigurationIcon : UserControl, IDisposable Background = TextElement.GetForeground(this), VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, - OpacityMask = new ImageBrush(new Bitmap(stream)) {BitmapInterpolationMode = BitmapInterpolationMode.MediumQuality} + OpacityMask = new ImageBrush(new Bitmap(stream)) }; } diff --git a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj index f344dc3a0..bdea0536c 100644 --- a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj +++ b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj @@ -21,12 +21,12 @@ - - + + - - - + + + diff --git a/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs b/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs index 331352a9a..3108bf5fe 100644 --- a/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs +++ b/src/Artemis.UI.Windows/Providers/AutoRunProvider.cs @@ -16,12 +16,6 @@ public class AutoRunProvider : IAutoRunProvider { private readonly string _autorunName = $"Artemis 2 autorun {Environment.UserName}"; private readonly string _oldAutorunName = "Artemis 2 autorun"; - private readonly IAssetLoader _assetLoader; - - public AutoRunProvider(IAssetLoader assetLoader) - { - _assetLoader = assetLoader; - } private async Task IsAutoRunTaskCreated(string autorunName) { @@ -43,7 +37,7 @@ public class AutoRunProvider : IAutoRunProvider private async Task CreateAutoRunTask(TimeSpan autoRunDelay, string autorunName) { - await using Stream taskFile = _assetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/autorun.xml")); + await using Stream taskFile = AssetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/autorun.xml")); XDocument document = await XDocument.LoadAsync(taskFile, LoadOptions.None, CancellationToken.None); XElement task = document.Descendants().First(); diff --git a/src/Artemis.UI.Windows/Providers/CursorProvider.cs b/src/Artemis.UI.Windows/Providers/CursorProvider.cs index 97a53f032..68227810e 100644 --- a/src/Artemis.UI.Windows/Providers/CursorProvider.cs +++ b/src/Artemis.UI.Windows/Providers/CursorProvider.cs @@ -9,11 +9,11 @@ namespace Artemis.UI.Windows.Providers; public class CursorProvider : ICursorProvider { - public CursorProvider(IAssetLoader assetLoader) + public CursorProvider() { - Rotate = new Cursor(new Bitmap(assetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/Cursors/aero_rotate.png"))), new PixelPoint(21, 10)); - Drag = new Cursor(new Bitmap(assetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/Cursors/aero_drag.png"))), new PixelPoint(11, 3)); - DragHorizontal = new Cursor(new Bitmap(assetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/Cursors/aero_drag_horizontal.png"))), new PixelPoint(16, 5)); + Rotate = new Cursor(new Bitmap(AssetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/Cursors/aero_rotate.png"))), new PixelPoint(21, 10)); + Drag = new Cursor(new Bitmap(AssetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/Cursors/aero_drag.png"))), new PixelPoint(11, 3)); + DragHorizontal = new Cursor(new Bitmap(AssetLoader.Open(new Uri("avares://Artemis.UI.Windows/Assets/Cursors/aero_drag_horizontal.png"))), new PixelPoint(16, 5)); } public Cursor Rotate { get; } diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index e480ed3aa..75fa4b7da 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -15,17 +15,17 @@ - - - - + + + + - - - - + + + + - + diff --git a/src/Artemis.UI/DryIoc/ContainerExtensions.cs b/src/Artemis.UI/DryIoc/ContainerExtensions.cs index 9d63bb539..310b06b21 100644 --- a/src/Artemis.UI/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI/DryIoc/ContainerExtensions.cs @@ -7,7 +7,6 @@ using Artemis.UI.Services.Updating; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Platform; using DryIoc; namespace Artemis.UI.DryIoc; @@ -24,11 +23,8 @@ public static class ContainerExtensions public static void RegisterUI(this IContainer container) { Assembly[] thisAssembly = {typeof(ContainerExtensions).Assembly}; - - container.RegisterInstance(new AssetLoader(), IfAlreadyRegistered.Throw); - container.Register(Reuse.Singleton); - container.RegisterMany(thisAssembly, type => type.IsAssignableTo()); + container.RegisterMany(thisAssembly, type => type.IsAssignableTo(), setup: Setup.With(preventDisposal: true)); container.RegisterMany(thisAssembly, type => type.IsAssignableTo() && type.IsInterface); container.RegisterMany(thisAssembly, type => type.IsAssignableTo() && type != typeof(PropertyVmFactory)); diff --git a/src/Artemis.UI/MainWindow.axaml.cs b/src/Artemis.UI/MainWindow.axaml.cs index a687aad64..701519b20 100644 --- a/src/Artemis.UI/MainWindow.axaml.cs +++ b/src/Artemis.UI/MainWindow.axaml.cs @@ -6,7 +6,6 @@ using Artemis.UI.Screens.Root; using Artemis.UI.Shared; using Avalonia; using Avalonia.Controls; -using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using ReactiveUI; @@ -15,28 +14,24 @@ namespace Artemis.UI; public partial class MainWindow : ReactiveAppWindow { private bool _activated; + private IDisposable? _positionObserver; public MainWindow() { Opened += OnOpened; + Closed += OnClosed; Activated += OnActivated; Deactivated += OnDeactivated; InitializeComponent(); ApplyWindowSize(); - + Shared.UI.Clipboard = GetTopLevel(this)!.Clipboard!; RootPanel.LayoutUpdated += OnLayoutUpdated; #if DEBUG this.AttachDevTools(); #endif - - Observable.FromEventPattern(x => PositionChanged += x, x => PositionChanged -= x) - .Select(_ => Unit.Default) - .Merge(this.WhenAnyValue(vm => vm.WindowState, vm => vm.Width, vm => vm.Width, vm => vm.Height).Select(_ => Unit.Default)) - .Throttle(TimeSpan.FromMilliseconds(200), AvaloniaScheduler.Instance) - .Subscribe(_ => SaveWindowSize()); } private void ApplyWindowSize() @@ -53,7 +48,7 @@ public partial class MainWindow : ReactiveAppWindow RootViewModel.WindowSizeSetting.Value ??= new WindowSize(); RootViewModel.WindowSizeSetting.Value.ApplyFromWindow(this); } - + private void OnLayoutUpdated(object? sender, EventArgs e) { SidebarContentControl.Width = RootPanel.Bounds.Width >= 1800 ? 300 : 240; @@ -61,8 +56,18 @@ public partial class MainWindow : ReactiveAppWindow private void OnOpened(object? sender, EventArgs e) { - Opened -= OnOpened; TitleBar.ExtendsContentIntoTitleBar = true; + + _positionObserver = Observable.FromEventPattern(x => PositionChanged += x, x => PositionChanged -= x) + .Select(_ => Unit.Default) + .Merge(this.WhenAnyValue(vm => vm.WindowState, vm => vm.Width, vm => vm.Width, vm => vm.Height).Select(_ => Unit.Default)) + .Throttle(TimeSpan.FromMilliseconds(200), AvaloniaScheduler.Instance) + .Subscribe(_ => SaveWindowSize()); + } + + private void OnClosed(object? sender, EventArgs e) + { + _positionObserver?.Dispose(); } private void OnActivated(object? sender, EventArgs e) @@ -74,5 +79,4 @@ public partial class MainWindow : ReactiveAppWindow { ViewModel?.Unfocused(); } - } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs index 06c735466..dc4390255 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs @@ -59,7 +59,7 @@ public class PlaybackViewModel : ActivatableViewModelBase updateTimer.Start(); Disposable.Create(() => { - // updateTimer.Stop(); + updateTimer.Stop(); _settingsService.GetSetting("ProfileEditor.RepeatTimeline", true).Value = _repeating && _repeatTimeline; _settingsService.GetSetting("ProfileEditor.RepeatSegment", false).Value = _repeating && _repeatSegment; }).DisposeWith(d); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertyGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertyGroupViewModel.cs index bb0c78c20..7427545ab 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertyGroupViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertyGroupViewModel.cs @@ -179,12 +179,12 @@ public class PropertyGroupViewModel : PropertyViewModelBase, IDisposable public void Dispose() { LayerPropertyGroup.VisibilityChanged -= LayerPropertyGroupOnVisibilityChanged; - foreach (ViewModelBase viewModelBase in Children) + while (Children.Any()) { - if (viewModelBase is IDisposable disposable) + if (Children[0] is IDisposable disposable) disposable.Dispose(); + Children.RemoveAt(0); } - _keyframeSubscription.Dispose(); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Root/RootViewModel.cs b/src/Artemis.UI/Screens/Root/RootViewModel.cs index dd90f1dd8..b9860c8c1 100644 --- a/src/Artemis.UI/Screens/Root/RootViewModel.cs +++ b/src/Artemis.UI/Screens/Root/RootViewModel.cs @@ -22,7 +22,6 @@ namespace Artemis.UI.Screens.Root; public class RootViewModel : ActivatableViewModelBase, IScreen, IMainWindowProvider { - private readonly IAssetLoader _assetLoader; private readonly ICoreService _coreService; private readonly IDebugService _debugService; private readonly DefaultTitleBarViewModel _defaultTitleBarViewModel; @@ -41,7 +40,6 @@ public class RootViewModel : ActivatableViewModelBase, IScreen, IMainWindowProvi IMainWindowService mainWindowService, IDebugService debugService, IUpdateService updateService, - IAssetLoader assetLoader, DefaultTitleBarViewModel defaultTitleBarViewModel, ISidebarVmFactory sidebarVmFactory) { @@ -53,7 +51,6 @@ public class RootViewModel : ActivatableViewModelBase, IScreen, IMainWindowProvi _windowService = windowService; _debugService = debugService; _updateService = updateService; - _assetLoader = assetLoader; _defaultTitleBarViewModel = defaultTitleBarViewModel; _sidebarVmFactory = sidebarVmFactory; _lifeTime = (IClassicDesktopStyleApplicationLifetime) Application.Current!.ApplicationLifetime!; diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml index a407de94a..d0d5aed6e 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml @@ -11,7 +11,7 @@ - + Artemis 2 @@ -52,9 +52,10 @@ Height="75" Width="75" Margin="0 0 15 0" - IsVisible="{CompiledBinding RobertProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{CompiledBinding RobertProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + @@ -80,9 +81,10 @@ Height="75" Width="75" Margin="0 0 15 0" - IsVisible="{CompiledBinding DarthAffeProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{CompiledBinding DarthAffeProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + @@ -108,9 +110,10 @@ Height="75" Width="75" Margin="0 0 15 0" - IsVisible="{CompiledBinding DrMeteorProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{CompiledBinding DrMeteorProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + @@ -136,9 +139,10 @@ Height="75" Width="75" Margin="0 0 15 0" - IsVisible="{CompiledBinding KaiProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{CompiledBinding KaiProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml index 4f714ae75..3aad0ce29 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml @@ -79,9 +79,13 @@ - + - + @@ -127,8 +131,9 @@ - Fade when enabling and disabling - + + Fade when enabling and disabling + diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs index 8ca0c9a41..c8f346714 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeMenuItemViewModel.cs @@ -18,11 +18,13 @@ public class NodeMenuItemViewModel public NodeMenuItemViewModel(ReactiveCommand createNode, NodeData nodeData) { Header = nodeData.Name; + Subtitle = nodeData.Description; Items = new List(); CreateNode = ReactiveCommand.Create(() => { createNode.Execute(nodeData).Subscribe(); }); } public string Header { get; } + public string? Subtitle { get; } public List Items { get; } public ReactiveCommand? CreateNode { get; } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml index 94f643cd5..491fcfb1e 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml @@ -1,20 +1,20 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:visualScripting="clr-namespace:Artemis.UI.Screens.VisualScripting" + xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" + xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" + xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" + xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" + xmlns:system="clr-namespace:System;assembly=System.Runtime" + mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:Class="Artemis.UI.Screens.VisualScripting.NodeScriptWindowView" + x:DataType="visualScripting:NodeScriptWindowViewModel" + Icon="/Assets/Images/Logo/application.ico" + Title="Artemis | Visual Script Editor" + Width="1200" + Height="800"> @@ -30,10 +30,21 @@ + + + + + + + + + diff --git a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj index e4b45b4b7..2a69a2d53 100644 --- a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj +++ b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj @@ -8,10 +8,10 @@ - - - - + + + + diff --git a/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj b/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj index 3492a7f04..c31da3c25 100644 --- a/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj +++ b/src/Artemis.WebClient.Updating/Artemis.WebClient.Updating.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/NuGet.config b/src/NuGet.config deleted file mode 100644 index 2a6054bcd..000000000 --- a/src/NuGet.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file