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/App.axaml b/src/Artemis.UI.Linux/App.axaml index 28101d004..61b3b65c3 100644 --- a/src/Artemis.UI.Linux/App.axaml +++ b/src/Artemis.UI.Linux/App.axaml @@ -1,6 +1,8 @@ @@ -12,16 +14,16 @@ - + - - - - + + + + - - + + diff --git a/src/Artemis.UI.Linux/App.axaml.cs b/src/Artemis.UI.Linux/App.axaml.cs index 1a6cd64a5..52f729727 100644 --- a/src/Artemis.UI.Linux/App.axaml.cs +++ b/src/Artemis.UI.Linux/App.axaml.cs @@ -22,18 +22,20 @@ public class App : Application Program.CreateLogger(_container); RxApp.MainThreadScheduler = AvaloniaScheduler.Instance; AvaloniaXamlLoader.Load(this); - - RegisterProviders(); } public override void OnFrameworkInitializationCompleted() { if (Design.IsDesignMode) return; - + + if (ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime desktop) + return; + ArtemisBootstrapper.Initialize(); - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - _applicationStateManager = new ApplicationStateManager(_container!, desktop.Args); + + _applicationStateManager = new ApplicationStateManager(_container!, desktop.Args); + RegisterProviders(); } private void RegisterProviders() diff --git a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj index 210637896..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.Linux/Providers/Input/Enums/LinuxDeviceType.cs b/src/Artemis.UI.Linux/Providers/Input/Enums/LinuxDeviceType.cs index e0d1d0381..7eb5c4976 100644 --- a/src/Artemis.UI.Linux/Providers/Input/Enums/LinuxDeviceType.cs +++ b/src/Artemis.UI.Linux/Providers/Input/Enums/LinuxDeviceType.cs @@ -2,6 +2,7 @@ public enum LinuxDeviceType { + Unknown, Keyboard, Mouse, Gamepad diff --git a/src/Artemis.UI.Linux/Providers/Input/LinuxInputDevice.cs b/src/Artemis.UI.Linux/Providers/Input/LinuxInputDevice.cs index 6771d2a2b..fa6b23e43 100644 --- a/src/Artemis.UI.Linux/Providers/Input/LinuxInputDevice.cs +++ b/src/Artemis.UI.Linux/Providers/Input/LinuxInputDevice.cs @@ -19,7 +19,7 @@ public class LinuxInputDevice switch (dataType) { case 'I': - InputId = new LinuxInputId(data); + InputId = data; break; case 'N': Name = data.Replace("\"", "").Replace("Name=", ""); @@ -27,14 +27,16 @@ public class LinuxInputDevice case 'H': Handlers = data.Replace("Handlers=", "").Split(" "); - if (Handlers?.Any(h => h.Contains("mouse")) == true) + if (Handlers.Any(h => h.Contains("mouse"))) DeviceType = LinuxDeviceType.Mouse; - else if (Handlers?.Any(h => h.Contains("kbd")) == true) + else if (Handlers.Any(h => h.Contains("kbd"))) DeviceType = LinuxDeviceType.Keyboard; - else if (Handlers?.Any(h => h.Contains("js")) == true) + else if (Handlers.Any(h => h.Contains("js"))) DeviceType = LinuxDeviceType.Gamepad; + else + DeviceType = LinuxDeviceType.Unknown; - string evt = Handlers!.First(h => h.Contains("event")); + string evt = Handlers.First(h => h.Contains("event")); EventPath = $"/dev/input/{evt}"; break; @@ -45,7 +47,7 @@ public class LinuxInputDevice throw new ArtemisLinuxInputProviderException("Linux device definition did not contain necessary data"); } - public LinuxInputId InputId { get; } + public string InputId { get; } public string Name { get; } public string[] Handlers { get; } public string EventPath { get; } @@ -60,29 +62,4 @@ public class LinuxInputDevice } #endregion - - public class LinuxInputId - { - public LinuxInputId(string line) - { - Dictionary components = line.Split(" ") - .Select(c => c.Split('=')) - .ToDictionary(c => c[0], c => c[1]); - - Bus = components["Bus"]; - Vendor = components["Vendor"]; - Product = components["Product"]; - Version = components["Version"]; - } - - public string Bus { get; } - public string Vendor { get; } - public string Product { get; } - public string Version { get; } - - public override string ToString() - { - return $"Bus={Bus} Vendor={Vendor} Product={Product} Version={Version}"; - } - } } \ No newline at end of file diff --git a/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceFinder.cs b/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceFinder.cs index be532d250..778ff432e 100644 --- a/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceFinder.cs +++ b/src/Artemis.UI.Linux/Providers/Input/LinuxInputDeviceFinder.cs @@ -11,9 +11,36 @@ public static class LinuxInputDeviceFinder public static IEnumerable Find() { - return File.ReadAllLines(DEVICES_FILE) - .PartitionBy(s => s?.Length == 0) //split on empty lines - .Select(lineGroup => new LinuxInputDevice(lineGroup)); + IEnumerable> lineGroups = File.ReadAllLines(DEVICES_FILE).PartitionBy(s => s?.Length == 0); //split on empty lines + + foreach (IEnumerable lineGroup in lineGroups) + { + LinuxInputDevice device; + + try + { + device = new LinuxInputDevice(lineGroup); + } + catch + { + continue; + //some devices don't have all the required data, we can ignore those + } + + if (ShouldReadDevice(device)) + { + yield return device; + } + } + } + + private static bool ShouldReadDevice(LinuxInputDevice device) + { + if (device.DeviceType == LinuxDeviceType.Unknown) + return false; + //possibly add more checks here + + return true; } //https://stackoverflow.com/questions/56623354 @@ -34,7 +61,7 @@ public static class LinuxInputDeviceFinder return groupNumber; }; return a - .Select(x => new {Value = x, GroupNumber = getGroupNumber(predicate(x))}) + .Select(x => new { Value = x, GroupNumber = getGroupNumber(predicate(x)) }) .Where(x => x.GroupNumber != null) .GroupBy(x => x.GroupNumber) .Select(g => g.Select(x => x.Value)); diff --git a/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs b/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs index 62866cb00..5c4349231 100644 --- a/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs +++ b/src/Artemis.UI.Linux/Providers/Input/LinuxInputProvider.cs @@ -75,7 +75,7 @@ public class LinuxInputProvider : InputProvider //_logger.Verbose($"Keyboard Key: {(LinuxKeyboardKeyCodes)args.Code} | Down: {isDown}"); - LinuxInputDevice.LinuxInputId identifier = keyboard.InputId; + string identifier = keyboard.InputId; OnIdentifierReceived(identifier, InputDeviceType.Keyboard); ArtemisDevice? device = null; @@ -93,7 +93,7 @@ public class LinuxInputProvider : InputProvider private void HandleMouseData(LinuxInputDevice mouse, LinuxInputEventArgs args) { - LinuxInputDevice.LinuxInputId identifier = mouse.InputId; + string identifier = mouse.InputId; OnIdentifierReceived(identifier, InputDeviceType.Mouse); ArtemisDevice? device = null; diff --git a/src/Artemis.UI.Linux/Utilities/InputUtilities.cs b/src/Artemis.UI.Linux/Utilities/InputUtilities.cs index f898ebb1e..1b567245a 100644 --- a/src/Artemis.UI.Linux/Utilities/InputUtilities.cs +++ b/src/Artemis.UI.Linux/Utilities/InputUtilities.cs @@ -52,7 +52,7 @@ public static class InputUtilities LinuxKeyboardKeyCodes.KEY_APOSTROPHE => KeyboardKey.OemQuotes, LinuxKeyboardKeyCodes.KEY_GRAVE => KeyboardKey.OemTilde, LinuxKeyboardKeyCodes.KEY_LEFTSHIFT => KeyboardKey.LeftShift, - LinuxKeyboardKeyCodes.KEY_BACKSLASH => KeyboardKey.OemBackslash, + LinuxKeyboardKeyCodes.KEY_BACKSLASH => KeyboardKey.OemPipe, LinuxKeyboardKeyCodes.KEY_Z => KeyboardKey.Z, LinuxKeyboardKeyCodes.KEY_X => KeyboardKey.X, LinuxKeyboardKeyCodes.KEY_C => KeyboardKey.C, @@ -94,7 +94,7 @@ public static class InputUtilities LinuxKeyboardKeyCodes.KEY_KP0 => KeyboardKey.NumPad0, LinuxKeyboardKeyCodes.KEY_KPDOT => KeyboardKey.NumPadDecimal, // LinuxKeyboardKeyCodes.KEY_ZENKAKUHANKAKU => expr, - // LinuxKeyboardKeyCodes.KEY_102ND => expr, + LinuxKeyboardKeyCodes.KEY_102ND => KeyboardKey.OemBackslash, LinuxKeyboardKeyCodes.KEY_F11 => KeyboardKey.F11, LinuxKeyboardKeyCodes.KEY_F12 => KeyboardKey.F12, //LinuxKeyboardKeyCodes.KEY_RO => expr, diff --git a/src/Artemis.UI.MacOS/App.axaml b/src/Artemis.UI.MacOS/App.axaml index 9eae579ca..a1b602647 100644 --- a/src/Artemis.UI.MacOS/App.axaml +++ b/src/Artemis.UI.MacOS/App.axaml @@ -1,6 +1,8 @@ @@ -12,16 +14,16 @@ - + - - - - + + + + - - + + diff --git a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj index 000fe864e..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 35cf357d8..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/DataModelPicker/DataModelPicker.cs b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs index 621a96161..e3168eaba 100644 --- a/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs +++ b/src/Artemis.UI.Shared/Controls/DataModelPicker/DataModelPicker.cs @@ -308,7 +308,7 @@ public class DataModelPicker : TemplatedControl { GetDataModel(); UpdateCurrentPath(true); - _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Normal, Update); + _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(200), DispatcherPriority.Background, Update); _updateTimer.Start(); } diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index b93053583..3d8a3192e 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -41,7 +41,6 @@ public class DeviceVisualizer : Control PropertyChanged += OnPropertyChanged; } - /// public override void Render(DrawingContext drawingContext) { @@ -67,8 +66,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 +304,9 @@ 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); - + using Bitmap scaledBitmap = bitmap.CreateScaledBitmap(renderTargetBitmap.PixelSize); + + context.DrawImage(scaledBitmap, new Rect(scaledBitmap.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..6c69cc674 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs @@ -46,11 +46,10 @@ internal class DeviceVisualizerLed try { using Bitmap bitmap = new(Led.Layout.Image.LocalPath); + using Bitmap scaledBitmap = bitmap.CreateScaledBitmap(new PixelSize((Led.RgbLed.Size.Width * scale).RoundToInt(), (Led.RgbLed.Size.Height * scale).RoundToInt())); 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 + scaledBitmap, + new Rect(Led.RgbLed.Location.X * scale, Led.RgbLed.Location.Y * scale, scaledBitmap.Size.Width, scaledBitmap.Size.Height) ); } catch diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml index 3edd26150..8322b5738 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml @@ -1,4 +1,4 @@ - diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml index 1849c97e5..19c39fd7d 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml @@ -3,11 +3,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + xmlns:local="clr-namespace:Artemis.UI.Shared" x:Class="Artemis.UI.Shared.EnumComboBox"> - - + + diff --git a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs index ff2869519..8fcd1eba4 100644 --- a/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/EnumComboBox.axaml.cs @@ -20,11 +20,9 @@ public partial class EnumComboBox : UserControl /// public static readonly StyledProperty ValueProperty = AvaloniaProperty.Register(nameof(Value), defaultBindingMode: BindingMode.TwoWay); - private readonly ObservableCollection<(Enum, string)> _currentValues = new(); + private readonly ObservableCollection _currentValues = new(); private Type? _currentType; - private ComboBox? _enumComboBox; - /// /// Creates a new instance of the class. /// @@ -54,35 +52,35 @@ public partial class EnumComboBox : UserControl private void OnSelectionChanged(object? sender, SelectionChangedEventArgs e) { - if (_enumComboBox == null || _enumComboBox.SelectedIndex == -1) + if (ChildEnumComboBox == null || ChildEnumComboBox.SelectedIndex == -1) return; - (Enum enumValue, _) = _currentValues[_enumComboBox.SelectedIndex]; - if (!Equals(Value, enumValue)) - Value = enumValue; + EnumComboBoxItem v = _currentValues[ChildEnumComboBox.SelectedIndex]; + if (!Equals(Value, v.Value)) + Value = v.Value; } private void UpdateValues() { Type? newType = Value?.GetType(); - if (_enumComboBox == null || newType == null || _currentType == newType) + if (ChildEnumComboBox == null || newType == null || _currentType == newType) return; _currentValues.Clear(); foreach ((Enum, string) valueDesc in EnumUtilities.GetAllValuesAndDescriptions(newType)) - _currentValues.Add(valueDesc); + _currentValues.Add(new EnumComboBoxItem(value: valueDesc.Item1, description: valueDesc.Item2)); _currentType = newType; } private void UpdateSelection() { - if (_enumComboBox == null || Value is not Enum) + if (ChildEnumComboBox == null || Value is not Enum) return; - (Enum, string) value = _currentValues.FirstOrDefault(v => v.Item1.Equals(Value)); - if (!Equals(value.Item1, _enumComboBox.SelectedItem)) - _enumComboBox.SelectedItem = value; + EnumComboBoxItem? value = _currentValues.FirstOrDefault(v => v.Value.Equals(Value)); + if (!Equals(value?.Value, ChildEnumComboBox.SelectedItem)) + ChildEnumComboBox.SelectedItem = value; } #region Overrides of TemplatedControl @@ -90,12 +88,11 @@ public partial class EnumComboBox : UserControl /// protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e) { - _enumComboBox = this.Get("ChildEnumComboBox"); - _enumComboBox.Items = _currentValues; + ChildEnumComboBox.ItemsSource = _currentValues; UpdateValues(); UpdateSelection(); - _enumComboBox.SelectionChanged += OnSelectionChanged; + ChildEnumComboBox.SelectionChanged += OnSelectionChanged; base.OnAttachedToLogicalTree(e); } @@ -103,11 +100,36 @@ public partial class EnumComboBox : UserControl /// protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e) { - if (_enumComboBox != null) - _enumComboBox.SelectionChanged -= OnSelectionChanged; + if (ChildEnumComboBox != null) + ChildEnumComboBox.SelectionChanged -= OnSelectionChanged; base.OnDetachedFromLogicalTree(e); } #endregion +} + +/// +/// Represents an item in the +/// +public class EnumComboBoxItem +{ + /// + /// Creates a new instance of the class. + /// + public EnumComboBoxItem(Enum value, string description) + { + Value = value; + Description = description; + } + + /// + /// Gets or sets the value of the item + /// + public Enum Value { get; set; } + + /// + /// Gets or sets the description of the item + /// + public string Description { get; set; } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml index 6b7e0c0c1..a3b624d5a 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml @@ -26,8 +26,8 @@ diff --git a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs index 555d21320..0448f9746 100644 --- a/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/HotkeyBox.axaml.cs @@ -35,6 +35,7 @@ public partial class HotkeyBox : UserControl UpdateDisplayTextBox(); } + /// protected override void OnGotFocus(GotFocusEventArgs e) { _inputService.KeyboardKeyDown += InputServiceOnKeyboardKeyDown; @@ -43,6 +44,7 @@ public partial class HotkeyBox : UserControl base.OnGotFocus(e); } + /// protected override void OnLostFocus(RoutedEventArgs e) { _inputService.KeyboardKeyDown -= InputServiceOnKeyboardKeyDown; 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.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs index 59ceef437..aa1a25ab4 100644 --- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs +++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs @@ -37,8 +37,8 @@ public abstract class DataModelVisualizationViewModel : ReactiveObject, IDisposa CopyPath = ReactiveCommand.CreateFromTask(async () => { - if (Application.Current?.Clipboard != null && Path != null) - await Application.Current.Clipboard.SetTextAsync(Path); + if (Path != null) + await UI.Clipboard.SetTextAsync(Path); }); if (parent == null) diff --git a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml index 8b3e3f3ee..bf4eb32f4 100644 --- a/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml +++ b/src/Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml @@ -3,22 +3,24 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + xmlns:local="clr-namespace:Artemis.UI.Shared.DefaultTypes.DataModel.Display" + x:DataType="local:DefaultDataModelDisplayViewModel" x:Class="Artemis.UI.Shared.DefaultTypes.DataModel.Display.DefaultDataModelDisplayView"> - + diff --git a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs index 1c86ecf84..c1e7006a7 100644 --- a/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI.Shared/DryIoc/ContainerExtensions.cs @@ -16,7 +16,7 @@ public static class ContainerExtensions public static void RegisterSharedUI(this IContainer container) { Assembly artemisShared = typeof(IArtemisSharedUIService).GetAssembly(); - container.RegisterMany(new[] { artemisShared }, type => type.IsAssignableTo(), Reuse.Singleton); + container.RegisterMany(new[] {artemisShared}, type => type.IsAssignableTo(), Reuse.Singleton); UI.Locator = container; } diff --git a/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs b/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs index 5ba268315..c506ee1d9 100644 --- a/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs +++ b/src/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs @@ -26,7 +26,8 @@ public class NotificationBuilder public NotificationBuilder(Window parent) { _parent = parent; - _infoBar = new InfoBar {Classes = Classes.Parse("notification-info-bar")}; + _infoBar = new InfoBar(); + _infoBar.Classes.Add("notification-info-bar"); } /// @@ -204,11 +205,18 @@ public class NotificationButtonBuilder internal Control Build() { + Button button = new() {Content = _text}; + button.Classes.Add("AppBarButton"); + if (_action != null) - return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action()), Classes = new Classes("AppBarButton")}; - if (_command != null) - return new Button {Content = _text, Command = _command, CommandParameter = _commandParameter, Classes = new Classes("AppBarButton")}; - return new Button {Content = _text, Classes = new Classes("AppBarButton")}; + button.Command = ReactiveCommand.Create(() => _action()); + else if (_command != null) + { + button.Command = _command; + button.CommandParameter = _commandParameter; + } + + return button; } } diff --git a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs index 6f91fbdfe..9ed8048c1 100644 --- a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs +++ b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputService.cs @@ -54,7 +54,7 @@ internal class PropertyInputService : IPropertyInputService return existing; } - _container.Register(viewModelType); + _container.Register(viewModelType, setup: Setup.With(preventDisposal: true)); PropertyInputRegistration registration = new(this, plugin, supportedType, viewModelType); _registeredPropertyEditors.Add(registration); return registration; diff --git a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs index d08f340de..1382de03b 100644 --- a/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs +++ b/src/Artemis.UI.Shared/Services/PropertyInput/PropertyInputViewModel.cs @@ -220,7 +220,7 @@ public abstract class PropertyInputViewModel : PropertyInputViewModel /// /// For internal use only, implement instead. /// -public abstract class PropertyInputViewModel : ReactiveValidationObject, IActivatableViewModel, IDisposable +public abstract class PropertyInputViewModel : ReactiveValidationObject, IActivatableViewModel { /// /// Prevents this type being implemented directly, implement @@ -228,29 +228,7 @@ public abstract class PropertyInputViewModel : ReactiveValidationObject, IActiva /// // ReSharper disable once UnusedMember.Global internal abstract object InternalGuard { get; } - - /// - /// Releases the unmanaged resources used by the object and optionally releases the managed resources. - /// - /// - /// to release both managed and unmanaged resources; - /// to release only unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - } - - #region Implementation of IActivatableViewModel - + /// public ViewModelActivator Activator { get; } = new(); - - #endregion - - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } } \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml index c4c3c9350..3bb950a0f 100644 --- a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml +++ b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogView.axaml @@ -2,9 +2,11 @@ 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:local="clr-namespace:Artemis.UI.Shared.Services" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="800" x:Class="Artemis.UI.Shared.Services.ExceptionDialogView" - Title="{Binding Title}" + x:DataType="local:ExceptionDialogViewModel" + Title="{CompiledBinding Title}" ExtendClientAreaToDecorationsHint="True" Width="800" Height="800" @@ -16,7 +18,7 @@ - + Awww :( @@ -27,7 +29,7 @@ - - - diff --git a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs index 7b256509e..06a3ea86c 100644 --- a/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs +++ b/src/Artemis.UI.Shared/Services/Window/ExceptionDialogViewModel.cs @@ -23,10 +23,7 @@ internal class ExceptionDialogViewModel : DialogViewModelBase public async Task CopyException() { - if (Application.Current?.Clipboard == null) - return; - - await Application.Current.Clipboard.SetTextAsync(Exception.ToString()); + await UI.Clipboard.SetTextAsync(Exception.ToString()); _notificationService.CreateNotification() .WithMessage("Copied stack trace to clipboard.") .WithSeverity(NotificationSeverity.Success) diff --git a/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml b/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml index 67ff351ca..662a1109f 100644 --- a/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml +++ b/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml @@ -19,7 +19,7 @@ + IsVisible="{CompiledBinding DataModelPath, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static ObjectConverters.IsNotNull}}"> + IsVisible="{CompiledBinding !IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/> + IsVisible="{CompiledBinding IsEventPicker, RelativeSource={RelativeSource TemplatedParent}}"/> Welcome to the data model picker Select a value from the data model below @@ -53,19 +53,19 @@ + ItemsSource="{CompiledBinding DataModelViewModel.Children, RelativeSource={RelativeSource TemplatedParent}}"> - + - + @@ -75,29 +75,29 @@ - + + ToolTip.Tip="{CompiledBinding PropertyDescription.Description}" + IsVisible="{CompiledBinding IsEventPicker, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type dataModelPicker:DataModelPicker}}}"/> - + - + - - + + diff --git a/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml b/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml index 680168261..ce985c2c6 100644 --- a/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml +++ b/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml @@ -88,7 +88,7 @@ Background="{DynamicResource LightCheckerboardBrush}" Margin="5 0"> - + - + [ - + ] - + - + [ - + ] - + @@ -74,13 +76,13 @@ [ - + ] - + - + @@ -88,29 +90,29 @@ [ - + ] List item # - + - + - + [ - + ] - + diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml index 8dadbd122..811534402 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml @@ -4,15 +4,17 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + xmlns:vm="clr-namespace:Artemis.UI.Screens.Debugger.Performance" + x:DataType="vm:PerformanceDebugPluginViewModel" x:Class="Artemis.UI.Screens.Debugger.Performance.PerformanceDebugPluginView"> - - + + - + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml index 27c44a856..da9e2c95e 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml @@ -4,11 +4,12 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Artemis.UI.Screens.Debugger.Performance" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:DataType="local:PerformanceDebugProfilerViewModel" x:Class="Artemis.UI.Screens.Debugger.Performance.PerformanceDebugProfilerView"> - + - - - - - - - + + + + + + diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml index 95af1449e..af60e504b 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml @@ -3,7 +3,9 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" + xmlns:debugger="clr-namespace:Artemis.UI.Screens.Debugger.Performance;assembly=Artemis.UI" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:DataType="debugger:PerformanceDebugViewModel" x:Class="Artemis.UI.Screens.Debugger.Performance.PerformanceDebugView"> @@ -23,18 +25,18 @@ - + - + - + - + - + diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugViewModel.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugViewModel.cs index 641899ad3..c21700423 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugViewModel.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugViewModel.cs @@ -26,7 +26,7 @@ public class PerformanceDebugViewModel : ActivatableViewModelBase { _coreService = coreService; _pluginManagementService = pluginManagementService; - _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Normal, (_, _) => Update()); + _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Background, (_, _) => Update()); DisplayName = "Performance"; diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml index c5258f3a3..9266fbc69 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml @@ -2,7 +2,9 @@ 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:local="clr-namespace:Artemis.UI.Screens.Debugger.Render" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:DataType="local:RenderDebugViewModel" x:Class="Artemis.UI.Screens.Debugger.Render.RenderDebugView"> Render @@ -15,17 +17,17 @@ - + - + - + - + - + diff --git a/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml b/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml index 310120d5c..5bbc3c926 100644 --- a/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml +++ b/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml @@ -4,6 +4,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="1050" + xmlns:devicedetectinput="clr-namespace:Artemis.UI.Screens.Device;assembly=Artemis.UI" + x:DataType="devicedetectinput:DeviceDetectInputViewModel" x:Class="Artemis.UI.Screens.Device.DeviceDetectInputView"> @@ -15,12 +17,12 @@ Width="300" Height="300" HorizontalAlignment="Center" - IsVisible="{Binding !IsMouse}" /> + IsVisible="{CompiledBinding !IsMouse}" /> + IsVisible="{CompiledBinding IsMouse}" /> This will teach Artemis to associate button/key presses with this specific device. diff --git a/src/Artemis.UI/Screens/Device/DeviceDetectInputViewModel.cs b/src/Artemis.UI/Screens/Device/DeviceDetectInputViewModel.cs index ee5d0922a..b915e14c6 100644 --- a/src/Artemis.UI/Screens/Device/DeviceDetectInputViewModel.cs +++ b/src/Artemis.UI/Screens/Device/DeviceDetectInputViewModel.cs @@ -7,6 +7,7 @@ using Artemis.Core.Services; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; +using Avalonia.Threading; using FluentAvalonia.UI.Controls; using ReactiveUI; using RGB.NET.Core; @@ -57,10 +58,13 @@ public class DeviceDetectInputViewModel : ContentDialogViewModelBase private void InputServiceOnDeviceIdentified() { - ContentDialog?.Hide(ContentDialogResult.Primary); - _notificationService.CreateNotification() - .WithMessage($"{Device.RgbDevice.DeviceInfo.DeviceName} identified 😁") - .WithSeverity(NotificationSeverity.Success) - .Show(); + Dispatcher.UIThread.Post(() => + { + ContentDialog?.Hide(ContentDialogResult.Primary); + _notificationService.CreateNotification() + .WithMessage($"{Device.RgbDevice.DeviceInfo.DeviceName} identified 😁") + .WithSeverity(NotificationSeverity.Success) + .Show(); + }); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml index e883d00a6..37234283e 100644 --- a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml +++ b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml @@ -54,9 +54,9 @@ - + - + diff --git a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml index b3f5fe049..080b36def 100644 --- a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml +++ b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml @@ -5,53 +5,56 @@ xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" + xmlns:local="clr-namespace:Artemis.UI.Screens.Device" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:DataType="local:DeviceSettingsViewModel" x:Class="Artemis.UI.Screens.Device.DeviceSettingsView"> - - + + Device="{CompiledBinding Device}" + RenderOptions.BitmapInterpolationMode="HighQuality" /> - + - - + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - + + diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml index a1daaad28..1cb69cd13 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml @@ -3,29 +3,31 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" + xmlns:device="clr-namespace:Artemis.UI.Screens.Device" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="Artemis.UI.Screens.Device.DeviceInfoTabView"> + x:Class="Artemis.UI.Screens.Device.DeviceInfoTabView" + x:DataType="device:DeviceInfoTabViewModel"> Device name - + Manufacturer - + Device type - - + + - + Physical layout - + @@ -33,20 +35,20 @@ Size (1px = 1mm) - + Location (1px = 1mm) - + Rotation (degrees) - - + + - + Logical layout - + @@ -59,14 +61,13 @@ + Text="{CompiledBinding DefaultLayoutPath}" /> @@ -74,12 +75,11 @@ - + diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs index 4c5516ee3..2a84f5581 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs @@ -1,3 +1,5 @@ +using Avalonia.Controls; +using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; @@ -10,4 +12,13 @@ public partial class DeviceInfoTabView : ReactiveUserControl - - - + + + - + - - - - - - - + + + + + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml b/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml index 28514fcdc..213762d55 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml @@ -16,9 +16,9 @@ - + Don't load default layout @@ -169,13 +169,13 @@ - - @@ -189,14 +189,14 @@ - - + + diff --git a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml index 6a1c2a4ff..e7c3bb42d 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml +++ b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml @@ -42,14 +42,14 @@ - - + + diff --git a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabViewModel.cs b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabViewModel.cs index 355c4a117..4d3acd760 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabViewModel.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabViewModel.cs @@ -1,4 +1,4 @@ -using System.Collections.ObjectModel; +using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; using System.Reactive.Disposables; @@ -6,8 +6,10 @@ using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Exceptions; using Artemis.UI.Shared; +using HidSharp.Reports.Units; using ReactiveUI; using RGB.NET.Core; +using Unit = System.Reactive.Unit; namespace Artemis.UI.Screens.Device; @@ -29,14 +31,14 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase Device = device; DisplayName = "Input Mappings"; - InputMappings = new ObservableCollection<(ArtemisLed, ArtemisLed)>(); - + InputMappings = new ObservableCollection(); + DeleteMapping = ReactiveCommand.Create(ExecuteDeleteMapping); + this.WhenActivated(d => { _selectedLeds.CollectionChanged += SelectedLedsOnCollectionChanged; _inputService.KeyboardKeyUp += InputServiceOnKeyboardKeyUp; UpdateInputMappings(); - Disposable.Create(() => { _selectedLeds.CollectionChanged -= SelectedLedsOnCollectionChanged; @@ -46,6 +48,8 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase }); } + public ReactiveCommand DeleteMapping { get; } + public ArtemisDevice Device { get; } public ArtemisLed? SelectedLed @@ -54,11 +58,11 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase set => RaiseAndSetIfChanged(ref _selectedLed, value); } - public ObservableCollection<(ArtemisLed, ArtemisLed)> InputMappings { get; } + public ObservableCollection InputMappings { get; } - public void DeleteMapping((ArtemisLed, ArtemisLed) inputMapping) + private void ExecuteDeleteMapping(ArtemisInputMapping inputMapping) { - Device.InputMappings.Remove(inputMapping.Item1); + Device.InputMappings.Remove(inputMapping.Original); UpdateInputMappings(); } @@ -88,7 +92,7 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase if (InputMappings.Any()) InputMappings.Clear(); - foreach ((ArtemisLed, ArtemisLed) tuple in Device.InputMappings.Select(m => (m.Key, m.Value))) + foreach (ArtemisInputMapping tuple in Device.InputMappings.Select(m => new ArtemisInputMapping(m.Key, m.Value))) InputMappings.Add(tuple); } @@ -96,4 +100,29 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase { SelectedLed = _selectedLeds.FirstOrDefault(); } +} + +/// +/// Represents a pair of LEDs, the original and the replacement +/// +public class ArtemisInputMapping +{ + /// + /// Creates a new instance of the class + /// + public ArtemisInputMapping(ArtemisLed original, ArtemisLed replacement) + { + Original = original; + Replacement = replacement; + } + + /// + /// The original LED + /// + public ArtemisLed Original { get; set; } + + /// + /// The replacement LED + /// + public ArtemisLed Replacement { get; set; } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Home/HomeView.axaml b/src/Artemis.UI/Screens/Home/HomeView.axaml index d6b0bbe35..2ce2016a0 100644 --- a/src/Artemis.UI/Screens/Home/HomeView.axaml +++ b/src/Artemis.UI/Screens/Home/HomeView.axaml @@ -13,7 +13,8 @@ VerticalAlignment="Top" Source="/Assets/Images/home-banner.png" Height="200" - Stretch="UniformToFill" /> + Stretch="UniformToFill" + RenderOptions.BitmapInterpolationMode="HighQuality"/> diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml index 0acb85de7..b25fbc844 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml @@ -31,7 +31,7 @@ diff --git a/src/Artemis.UI/Screens/Plugins/Features/PluginFeatureView.axaml b/src/Artemis.UI/Screens/Plugins/Features/PluginFeatureView.axaml index 0b8bd3873..4141ec69e 100644 --- a/src/Artemis.UI/Screens/Plugins/Features/PluginFeatureView.axaml +++ b/src/Artemis.UI/Screens/Plugins/Features/PluginFeatureView.axaml @@ -38,7 +38,7 @@ IsVisible="{CompiledBinding LoadException, Converter={x:Static ObjectConverters.IsNotNull}}" Foreground="#E74C4C" ToolTip.Tip="An exception occurred while enabling this feature, click to view" - Command="{Binding ViewLoadException}"> + Command="{CompiledBinding ViewLoadException}"> diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml b/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml index 381a04dc0..ffed28a76 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml @@ -13,7 +13,7 @@ Plugin features - + diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml index a38d666b6..7943954b6 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml @@ -13,7 +13,7 @@ Height="800" WindowStartupLocation="CenterOwner"> - + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/PluginView.axaml b/src/Artemis.UI/Screens/Plugins/PluginView.axaml index 640279366..f35e54630 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginView.axaml @@ -22,7 +22,7 @@ - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml index fd8a5ca96..3a45411d3 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml @@ -24,7 +24,7 @@ Grid.Row="1" Classes="condition-type" PlaceholderText="Select an activation type" - Items="{CompiledBinding ConditionTypeViewModels}" + ItemsSource="{CompiledBinding ConditionTypeViewModels}" IsEnabled="{CompiledBinding ProfileElement, Converter={x:Static ObjectConverters.IsNotNull}}" SelectedItem="{CompiledBinding SelectedConditionTypeViewModel}" HorizontalAlignment="Stretch"> diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs index 80039a4ba..dc4390255 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackViewModel.cs @@ -55,7 +55,7 @@ public class PlaybackViewModel : ActivatableViewModelBase _keyBindingsEnabled = Shared.UI.KeyBindingsEnabled.ToProperty(this, vm => vm.KeyBindingsEnabled).DisposeWith(d); _lastUpdate = DateTime.MinValue; - DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Render, Update); + DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Background, Update); updateTimer.Start(); Disposable.Create(() => { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml index 1ff26bba4..95274a66e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml @@ -37,7 +37,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -67,22 +67,22 @@ - + - + - + - + @@ -91,7 +91,7 @@ Add hint - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml index aa95e39f5..a29cd584d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml @@ -20,11 +20,11 @@ + IsVisible="{CompiledBinding !IsExpanded, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TreeViewItem}}}" /> + IsVisible="{CompiledBinding IsExpanded, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TreeViewItem}}}" /> diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml index 286b33c93..bfea0d4e5 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml @@ -54,8 +54,8 @@ - - + + @@ -66,10 +66,10 @@ - - - - + + + + @@ -80,8 +80,8 @@ - - + + @@ -91,17 +91,17 @@ - - + + diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs index 9d995f005..4b88eac4c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs @@ -256,15 +256,9 @@ public abstract class TreeItemViewModel : ActivatableViewModelBase private async void UpdateCanPaste(bool isFlyoutOpen) { - if (Application.Current?.Clipboard == null) - { - CanPaste = false; - return; - } - - string[] formats = await Application.Current.Clipboard.GetFormatsAsync(); + string[] formats = await Shared.UI.Clipboard.GetFormatsAsync(); //diogotr7: This can be null on Linux sometimes. I'm not sure why. - if (formats == null) + if (formats == null!) { CanPaste = false; return; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml index f339a35f5..7ef69ab69 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml @@ -26,7 +26,7 @@ VerticalAlignment="Center" HorizontalAlignment="Right" Margin="10" - Command="{Binding OpenEditor}"> + Command="{CompiledBinding OpenEditor}"> diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs index 078452a81..672e50490 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs @@ -50,7 +50,7 @@ public class DataBindingViewModel : ActivatableViewModelBase .DisposeWith(d); _profileEditorService.Playing.CombineLatest(_profileEditorService.SuspendedEditing).Subscribe(tuple => _playing = tuple.First || tuple.Second).DisposeWith(d); - DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Render, Update); + DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Background, Update); // TODO: Remove in favor of saving each time a node editor command is executed DispatcherTimer saveTimer = new(TimeSpan.FromMinutes(2), DispatcherPriority.Normal, Save); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml index 6cba34e15..9bd77b7e2 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml @@ -14,7 +14,7 @@ diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml index 953cb4fc8..2ad155bd1 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml @@ -28,7 +28,7 @@ Name="TreeScrollViewer" Offset="{CompiledBinding #TimelineScrollViewer.Offset, Mode=OneWay}"> - + 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/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml index 6397ce1bc..f72a45823 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml @@ -32,7 +32,7 @@ - + @@ -39,7 +40,7 @@ diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml index 2184894c9..2cc8139e6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml @@ -5,7 +5,7 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.ProfileEditor.Properties.Timeline.TimelinePropertyView"> - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml index 5b3669d16..bba79ebed 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml @@ -10,14 +10,14 @@ x:DataType="timeline:TimelineViewModel"> - + - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs index ec06ddc2b..a4c4952ba 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs @@ -169,10 +169,10 @@ public class TimelineViewModel : ActivatableViewModelBase private async Task ExecutePasteKeyframes() { - if (_profileElement == null || Application.Current?.Clipboard == null) + if (_profileElement == null) return; - List? keyframes = await Application.Current.Clipboard.GetJsonAsync>(KeyframeClipboardModel.ClipboardDataFormat); + List? keyframes = await Shared.UI.Clipboard.GetJsonAsync>(KeyframeClipboardModel.ClipboardDataFormat); if (keyframes == null) return; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml index d69042659..464e1d37d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml @@ -14,7 +14,7 @@ diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml index 253913734..9ed3c8be1 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml @@ -25,7 +25,7 @@ BorderBrush="{DynamicResource ButtonBorderBrush}" BorderThickness="0,0,0,1" Height="29"> - + - diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml index 64b32bf15..2d87a8108 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml @@ -15,7 +15,7 @@ BorderBrush="{DynamicResource ButtonBorderBrush}" BorderThickness="0,0,0,1" Height="29"> - + { - Observable.FromEventPattern(e => ViewModel!.BaseLayerProperty.CurrentValueSet += e, e => ViewModel!.BaseLayerProperty.CurrentValueSet -= e) - .Subscribe(_ => this.BringIntoView()) - .DisposeWith(d); + ITreePropertyViewModel? viewModel = ViewModel; + if (viewModel != null) + { + Observable.FromEventPattern(e => viewModel.BaseLayerProperty.CurrentValueSet += e, e => viewModel.BaseLayerProperty.CurrentValueSet -= e) + .Subscribe(_ => this.BringIntoView()) + .DisposeWith(d); + } }); } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs index ecceb942b..8c7e214a5 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs @@ -32,7 +32,6 @@ internal class TreePropertyViewModel : ActivatableViewModelBase, ITreePropert _profileEditorService.Time.Subscribe(t => _time = t).DisposeWith(d); _isCurrentlySelected = _profileEditorService.LayerProperty.Select(l => l == LayerProperty).ToProperty(this, vm => vm.IsCurrentlySelected).DisposeWith(d); _dataBindingEnabled = LayerProperty.BaseDataBinding.AsObservable().Select(b => b.IsEnabled).ToProperty(this, vm => vm.DataBindingEnabled).DisposeWith(d); - this.WhenAnyValue(vm => vm.LayerProperty.KeyframesEnabled).Subscribe(_ => this.RaisePropertyChanged(nameof(KeyframesEnabled))).DisposeWith(d); }); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml index 9395cb9a5..cf0b73621 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml @@ -3,16 +3,18 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" + xmlns:local="clr-namespace:Artemis.UI.Screens.ProfileEditor.Properties.Windows" + x:DataType="local:BrushConfigurationWindowViewModel" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.ProfileEditor.Properties.Windows.BrushConfigurationWindowView" Icon="/Assets/Images/Logo/application.ico" Title="Artemis | Brush configuration" - Width="{Binding Configuration.DialogWidth}" - Height="{Binding Configuration.DialogHeight}" + Width="{CompiledBinding Configuration.DialogWidth}" + Height="{CompiledBinding Configuration.DialogHeight}" WindowStartupLocation="CenterOwner"> - + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml index a6ef2ccd7..134bb9147 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml @@ -3,16 +3,18 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" + xmlns:local="clr-namespace:Artemis.UI.Screens.ProfileEditor.Properties.Windows" + x:DataType="local:EffectConfigurationWindowViewModel" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.ProfileEditor.Properties.Windows.EffectConfigurationWindowView" Icon="/Assets/Images/Logo/application.ico" Title="Artemis | Effect configuration" - Width="{Binding Configuration.DialogWidth}" - Height="{Binding Configuration.DialogHeight}" + Width="{CompiledBinding Configuration.DialogWidth}" + Height="{CompiledBinding Configuration.DialogHeight}" WindowStartupLocation="CenterOwner"> - + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml index 4ee09fed8..25c79efee 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml @@ -5,7 +5,9 @@ xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="23" - x:Class="Artemis.UI.Screens.ProfileEditor.StatusBar.StatusBarView"> + xmlns:vm="clr-namespace:Artemis.UI.Screens.ProfileEditor.StatusBar;assembly=Artemis.UI" + x:DataType="vm:StatusBarViewModel" + x:Class="Artemis.UI.Screens.ProfileEditor.StatusBar.StatusBarView"> - + - + - + - - + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml index 5a5634690..031b8bad3 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml @@ -6,12 +6,12 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools.SelectionAddToolView" ClipToBounds="False"> - + ZoomRatio="{CompiledBinding $parent[ZoomBorder].ZoomX}"> diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml index 16e6a5aba..3c5bd1fc1 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml @@ -8,12 +8,12 @@ x:Class="Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools.SelectionRemoveToolView" ClipToBounds="False"> - + ZoomRatio="{CompiledBinding $parent[ZoomBorder].ZoomX}"> diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml index b8e1c5756..1056b0f8f 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml @@ -5,6 +5,7 @@ xmlns:paz="clr-namespace:Avalonia.Controls.PanAndZoom;assembly=Avalonia.Controls.PanAndZoom" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" xmlns:visualEditor="clr-namespace:Artemis.UI.Screens.ProfileEditor.VisualEditor" + xmlns:vis="clr-namespace:Artemis.UI.Screens.ProfileEditor.VisualEditor.Visualizers" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.ProfileEditor.VisualEditor.VisualEditorView" @@ -38,11 +39,11 @@ - + - @@ -52,17 +53,17 @@ - + - + - @@ -73,7 +74,7 @@ - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml index 2e6af4e05..e2693f3ee 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml @@ -47,8 +47,8 @@ - @@ -70,7 +70,7 @@ - + - + - + @@ -109,9 +109,9 @@ - + - + @@ -124,9 +124,9 @@ - + - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorViewModel.cs index 435ab4655..7351e4f80 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorViewModel.cs @@ -22,7 +22,6 @@ namespace Artemis.UI.Screens.ProfileEditor; public class ProfileEditorViewModel : MainScreenViewModel { - private readonly IMainWindowService _mainWindowService; private readonly IProfileEditorService _profileEditorService; private readonly ISettingsService _settingsService; private readonly SourceList _tools; @@ -51,7 +50,6 @@ public class ProfileEditorViewModel : MainScreenViewModel { _profileEditorService = profileEditorService; _settingsService = settingsService; - _mainWindowService = mainWindowService; _tools = new SourceList(); _tools.AddRange(toolViewModels); @@ -77,6 +75,8 @@ public class ProfileEditorViewModel : MainScreenViewModel { mainWindowService.MainWindowFocused -= MainWindowServiceOnMainWindowFocused; mainWindowService.MainWindowUnfocused -= MainWindowServiceOnMainWindowUnfocused; + foreach (IToolViewModel toolViewModel in _tools.Items) + toolViewModel.Dispose(); }).DisposeWith(d); // Slow and steady wins the race (and doesn't lock up the entire UI) diff --git a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml index 057fca3d0..975bc5e35 100644 --- a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml +++ b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml @@ -4,9 +4,11 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia" + xmlns:root="clr-namespace:Artemis.UI.Screens.Root;assembly=Artemis.UI" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:DataType="root:DefaultTitleBarViewModel" x:Class="Artemis.UI.Screens.Root.DefaultTitleBarView"> - \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Root/RootView.axaml b/src/Artemis.UI/Screens/Root/RootView.axaml index c3fcadfac..aac7dafea 100644 --- a/src/Artemis.UI/Screens/Root/RootView.axaml +++ b/src/Artemis.UI/Screens/Root/RootView.axaml @@ -4,10 +4,12 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:reactiveUi="http://reactiveui.net" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + xmlns:vm="clr-namespace:Artemis.UI.Screens.Root;assembly=Artemis.UI" + x:DataType="vm:RootViewModel" x:Class="Artemis.UI.Screens.Root.RootView"> - + - + \ 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/Root/SplashView.axaml b/src/Artemis.UI/Screens/Root/SplashView.axaml index 8fc7b8753..42e341abd 100644 --- a/src/Artemis.UI/Screens/Root/SplashView.axaml +++ b/src/Artemis.UI/Screens/Root/SplashView.axaml @@ -15,7 +15,7 @@ ExtendClientAreaToDecorationsHint="True" ExtendClientAreaTitleBarHeightHint="450"> - + @@ -12,14 +13,14 @@ Script name Script type - + - + diff --git a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml index 22f4d5c00..6402e977d 100644 --- a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml +++ b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml @@ -16,7 +16,7 @@ - + diff --git a/src/Artemis.UI/Screens/Settings/SettingsView.axaml b/src/Artemis.UI/Screens/Settings/SettingsView.axaml index 78ac70be4..386c31d3c 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsView.axaml +++ b/src/Artemis.UI/Screens/Settings/SettingsView.axaml @@ -7,10 +7,10 @@ x:Class="Artemis.UI.Screens.Settings.SettingsView" x:DataType="settings:SettingsViewModel"> - + - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml index 00014fa1e..d0d5aed6e 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml @@ -4,12 +4,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" + xmlns:vm="clr-namespace:Artemis.UI.Screens.Settings;assembly=Artemis.UI" + x:DataType="vm:AboutTabViewModel" mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1400" x:Class="Artemis.UI.Screens.Settings.AboutTabView"> - + Artemis 2 @@ -30,7 +32,7 @@ Grid.Column="1" VerticalAlignment="Top" Classes="subtitle" - Text="{Binding Version}" /> + Text="{CompiledBinding Version}" /> + IsVisible="{CompiledBinding RobertProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + @@ -78,9 +81,10 @@ Height="75" Width="75" Margin="0 0 15 0" - IsVisible="{Binding DarthAffeProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{CompiledBinding DarthAffeProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + @@ -106,9 +110,10 @@ Height="75" Width="75" Margin="0 0 15 0" - IsVisible="{Binding DrMeteorProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{CompiledBinding DrMeteorProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + @@ -134,9 +139,10 @@ Height="75" Width="75" Margin="0 0 15 0" - IsVisible="{Binding KaiProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"> + IsVisible="{CompiledBinding KaiProfileImage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" + RenderOptions.BitmapInterpolationMode="HighQuality"> - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml index 4561b8ac3..bea3fad48 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml @@ -2,8 +2,10 @@ 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:settings="clr-namespace:Artemis.UI.Screens.Settings" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="Artemis.UI.Screens.Settings.DevicesTabView"> + x:Class="Artemis.UI.Screens.Settings.DevicesTabView" + x:DataType="settings:DevicesTabViewModel"> Device management @@ -16,7 +18,7 @@ - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml index 86f46d2bf..002d2cb66 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml @@ -238,7 +238,7 @@ @@ -279,7 +279,7 @@ + ItemsSource="{CompiledBinding GraphicsContexts}" /> @@ -296,9 +296,9 @@ + ItemsSource="{CompiledBinding RenderScales}"> - + @@ -322,9 +322,9 @@ + ItemsSource="{CompiledBinding TargetFrameRates}"> - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml index 06a0deb5b..cdaf065aa 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml @@ -25,7 +25,7 @@ - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml index aee70e179..c3dd00ae8 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml @@ -36,7 +36,7 @@ - + diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementViewModel.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementViewModel.cs index b1cad321f..8a51d3810 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementViewModel.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementViewModel.cs @@ -23,7 +23,7 @@ public class ModuleActivationRequirementViewModel : ActivatableViewModelBase this.WhenActivated(d => { - _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Normal, Update); + _updateTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(500), DispatcherPriority.Background, Update); _updateTimer.Start(); Disposable.Create(() => diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml index 2a0d32131..cead09bfd 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml @@ -21,7 +21,7 @@ These requirements allow the module creator to decide when the data is available to your profile you cannot override them. - + diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml index bbf4b964b..3aad0ce29 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml @@ -46,14 +46,14 @@ Profile name Module - + - + @@ -79,9 +79,13 @@ - + - + @@ -104,7 +108,7 @@ - - Fade when enabling and disabling - + + Fade when enabling and disabling + diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml index fb725cfb1..25f43bbf2 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml @@ -115,8 +115,8 @@ - - + + @@ -125,8 +125,8 @@ - - + + @@ -139,8 +139,8 @@ Margin="0 8 0 0" RowDefinitions="Auto,*" ContextFlyout="{StaticResource CategoryMenuFlyout}" - Classes.flyout-open="{Binding IsOpen, Source={StaticResource CategoryMenuFlyout}}" - Classes.plus-flyout-open="{Binding IsOpen, Source={StaticResource PlusMenuFlyout}}"> + Classes.flyout-open="{CompiledBinding IsOpen, Source={StaticResource CategoryMenuFlyout}}" + Classes.plus-flyout-open="{CompiledBinding IsOpen, Source={StaticResource PlusMenuFlyout}}"> + Classes.flyout-open="{CompiledBinding IsOpen, Source={StaticResource ProfileMenuFlyout}}"> - - + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml index e79099445..1b1704472 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml @@ -23,14 +23,14 @@ - + - + diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs index 5a97fed62..1100cec9d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs @@ -10,7 +10,7 @@ public partial class InputPinView : PinView public InputPinView() { InitializeComponent(); - InitializePin(this.Get("PinPoint")); + InitializePin(PinPoint); } diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml index 4c4eef93f..b98412f7a 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml @@ -14,7 +14,7 @@ Command="{CompiledBinding AddPin}"> - + diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs index 9ba43f5c8..ed186c039 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs @@ -10,7 +10,7 @@ public partial class OutputPinView : PinView public OutputPinView() { InitializeComponent(); - InitializePin(this.Get("PinPoint")); + InitializePin(PinPoint); } diff --git a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml index 819a09302..85338fd4b 100644 --- a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml +++ b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml @@ -55,7 +55,7 @@ - diff --git a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj index 03500a177..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.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml index bfe7ab314..4a323a590 100644 --- a/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/External/Screens/LayerPropertyNodeCustomView.axaml @@ -8,8 +8,8 @@ x:DataType="screens:LayerPropertyNodeCustomViewModel"> - - + + diff --git a/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml index f9a87a72c..bcb70f3f2 100644 --- a/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Input/Screens/PressedKeyPositionNodeCustomView.axaml @@ -11,7 +11,7 @@ x:DataType="screens:PressedKeyPositionNodeCustomViewModel"> Layer - + diff --git a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml index b97440803..3d6357933 100644 --- a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml @@ -3,10 +3,12 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + xmlns:vm="clr-namespace:Artemis.VisualScripting.Nodes.Operators.Screens" + x:DataType="vm:EnumEqualsNodeCustomViewModel" x:Class="Artemis.VisualScripting.Nodes.Operators.Screens.EnumEqualsNodeCustomView"> - @@ -17,7 +19,7 @@ - + diff --git a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs index 7fee56fa6..f4a99a08d 100644 --- a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomViewModel.cs @@ -42,15 +42,15 @@ public class EnumEqualsNodeCustomViewModel : CustomNodeViewModel }); } - public ObservableCollection<(long, string)> EnumValues { get; } = new(); + public ObservableCollection EnumValues { get; } = new(); - public (long, string) CurrentValue + public EnumValueItem CurrentValue { - get => EnumValues.FirstOrDefault(v => v.Item1 == _node.Storage); + get => EnumValues.FirstOrDefault(v => v.Value == _node.Storage); set { - if (!Equals(_node.Storage, value.Item1)) - _nodeEditorService.ExecuteCommand(Script, new UpdateStorage(_node, value.Item1)); + if (!Equals(_node.Storage, value.Value)) + _nodeEditorService.ExecuteCommand(Script, new UpdateStorage(_node, value.Value)); } } @@ -58,13 +58,38 @@ public class EnumEqualsNodeCustomViewModel : CustomNodeViewModel { Dispatcher.UIThread.Post(() => { - List<(long, string)> values = Enum.GetValues(type).Cast().Select(e => (Convert.ToInt64(e), e.Humanize())).ToList(); + List values = Enum.GetValues(type).Cast().Select(e => new EnumValueItem(value: Convert.ToInt64(e), name: e.Humanize())).ToList(); if (values.Count > 20) - EnumValues.AddRange(values.OrderBy(v => v.Item2)); + EnumValues.AddRange(values.OrderBy(v => v.Name)); else - EnumValues.AddRange(Enum.GetValues(type).Cast().Select(e => (Convert.ToInt64(e), e.Humanize()))); + EnumValues.AddRange(values); this.RaisePropertyChanged(nameof(CurrentValue)); }, DispatcherPriority.Background); } +} + +/// +/// Represents a single enum value +/// +public class EnumValueItem +{ + /// + /// Creates a new instance of the class. + /// + public EnumValueItem(long value, string name) + { + Value = value; + Name = name; + } + + /// + /// The underlying value of the enum + /// + public long Value { get; set; } + + /// + /// The name of the enum value + /// + public string Name { get; set; } } \ No newline at end of file diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml index de10ffaa4..8ddaf5f77 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomView.axaml @@ -38,7 +38,7 @@ ClipToBounds="True"> - + @@ -46,7 +46,7 @@ - + diff --git a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomViewModel.cs b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomViewModel.cs index fc0c0b977..f9e462de4 100644 --- a/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomViewModel.cs +++ b/src/Artemis.VisualScripting/Nodes/Static/Screens/DisplayValueNodeCustomViewModel.cs @@ -18,7 +18,7 @@ public class DisplayValueNodeCustomViewModel : CustomNodeViewModel // Because the DisplayValueNode has no output it never evaluates, manually do so here this.WhenActivated(d => { - DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update); + DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Background, Update); updateTimer.Start(); Disposable.Create(() => updateTimer.Stop()).DisposeWith(d); }); diff --git a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml index 0170bd620..457cb2994 100644 --- a/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml +++ b/src/Artemis.VisualScripting/Nodes/Transition/Screens/EasingFunctionNodeCustomView.axaml @@ -6,5 +6,5 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.VisualScripting.Nodes.Transition.Screens.EasingFunctionNodeCustomView" x:DataType="screens:EasingFunctionNodeCustomViewModel"> - + \ No newline at end of file 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 @@ - - + +