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.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.Shared/Controls/DraggableNumberBox.axaml b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml index 68335adf2..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 bd702941f..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.ItemsSource = _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/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/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/Styles/Controls/DataModelPicker.axaml b/src/Artemis.UI.Shared/Styles/Controls/DataModelPicker.axaml index 425316ee9..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 7c3915871..ce985c2c6 100644 --- a/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml +++ b/src/Artemis.UI.Shared/Styles/Controls/GradientPicker.axaml @@ -103,10 +103,10 @@ - + GradientPicker="{CompiledBinding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type gradientPicker:GradientPicker}}}"> @@ -152,7 +152,7 @@ - + @@ -174,8 +174,8 @@ UseColorTriangle="True" IsMoreButtonVisible="True" IsVisible="{TemplateBinding SelectedColorStop, Converter={x:Static ObjectConverters.IsNotNull}}" - IsCompact="{Binding IsCompact, RelativeSource={RelativeSource TemplatedParent}}" - Color="{Binding SelectedColorStop.Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource SKColorToColorConverter}}" /> + IsCompact="{CompiledBinding IsCompact, RelativeSource={RelativeSource TemplatedParent}}" + Color="{CompiledBinding SelectedColorStop.Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource SKColorToColorConverter}}" /> @@ -196,19 +196,19 @@ BorderBrush="{DynamicResource ButtonBorderBrush}" ClipToBounds="True" Background="{DynamicResource LightCheckerboardBrush}"> - + - + - + diff --git a/src/Artemis.UI.Windows/App.axaml b/src/Artemis.UI.Windows/App.axaml index 2dfcff610..b9e069434 100644 --- a/src/Artemis.UI.Windows/App.axaml +++ b/src/Artemis.UI.Windows/App.axaml @@ -1,6 +1,8 @@ @@ -12,16 +14,16 @@ - + - - - - + + + + - - + + diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml index 703fb2eba..c84206870 100644 --- a/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml +++ b/src/Artemis.UI/DefaultTypes/PropertyInput/BrushPropertyInputView.axaml @@ -34,7 +34,7 @@ - + IsVisible="{CompiledBinding (DataValidationErrors.HasErrors)}" /> - + @@ -30,9 +31,9 @@ - + - + diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml index a34d03df0..cab34445c 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml @@ -5,7 +5,9 @@ xmlns:dataModel="clr-namespace:Artemis.UI.Shared.DataModelVisualization.Shared;assembly=Artemis.UI.Shared" xmlns:converters="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" + xmlns:local="clr-namespace:Artemis.UI.Screens.Debugger.DataModel" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:DataType="local:DataModelDebugViewModel" x:Class="Artemis.UI.Screens.Debugger.DataModel.DataModelDebugView"> @@ -21,14 +23,14 @@ - + - + [ - + ] - + - + [ - + ] - + @@ -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 a63c6b3c2..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 73b41e704..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 9debe0621..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/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/DeviceSettingsView.axaml b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml index b3f5fe049..6c6330055 100644 --- a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml +++ b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml @@ -5,7 +5,9 @@ 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"> @@ -14,7 +16,7 @@ HorizontalAlignment="Center" Margin="5" ShowColors="False" - Device="{Binding Device}" + Device="{CompiledBinding Device}" Grid.Row="0" /> - + - - + + - + - + - + - + diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml b/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml index dd1ad41cb..bdd07da58 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml @@ -14,21 +14,21 @@ - - + + - + - - - - - - - + + + + + + + \ 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 1a6f7e5fc..213762d55 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml @@ -18,7 +18,7 @@ - + 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 ccd896545..e7c3bb42d 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml +++ b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml @@ -48,8 +48,8 @@ AutoGenerateColumns="False" Margin="10"> - - + + diff --git a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabViewModel.cs b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabViewModel.cs index 5ab20e8fe..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; @@ -31,8 +31,8 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase Device = device; DisplayName = "Input Mappings"; - InputMappings = new ObservableCollection<(ArtemisLed, ArtemisLed)>(); - DeleteMapping = ReactiveCommand.Create<(ArtemisLed, ArtemisLed)>(ExecuteDeleteMapping); + InputMappings = new ObservableCollection(); + DeleteMapping = ReactiveCommand.Create(ExecuteDeleteMapping); this.WhenActivated(d => { @@ -48,7 +48,7 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase }); } - public ReactiveCommand<(ArtemisLed, ArtemisLed), Unit> DeleteMapping { get; } + public ReactiveCommand DeleteMapping { get; } public ArtemisDevice Device { get; } @@ -58,11 +58,11 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase set => RaiseAndSetIfChanged(ref _selectedLed, value); } - public ObservableCollection<(ArtemisLed, ArtemisLed)> InputMappings { get; } + public ObservableCollection InputMappings { get; } - private void ExecuteDeleteMapping((ArtemisLed, ArtemisLed) inputMapping) + private void ExecuteDeleteMapping(ArtemisInputMapping inputMapping) { - Device.InputMappings.Remove(inputMapping.Item1); + Device.InputMappings.Remove(inputMapping.Original); UpdateInputMappings(); } @@ -92,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); } @@ -100,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/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/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/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml index 3f56d7596..95274a66e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml @@ -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 f11b1d995..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 @@ - - + + @@ -96,12 +96,12 @@ SelectionChanged="ProfileTreeView_OnSelectionChanged"> - - + + 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/Timeline/Segments/EndSegmentView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml index 4b81a53c7..d49617362 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml @@ -22,7 +22,7 @@ - + @@ -38,7 +38,7 @@ Name="AddMainSegment" Classes="AppBarButton icon-button icon-button-small" ToolTip.Tip="Add main segment" - Command="{Binding AddMainSegment}" + Command="{CompiledBinding AddMainSegment}" IsVisible="{CompiledBinding ShowAddMain}"> @@ -52,7 +52,7 @@ diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml index 9325e0d67..846f1d021 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml @@ -22,7 +22,7 @@ - + @@ -39,7 +39,7 @@ Classes="AppBarButton icon-button icon-button-small" VerticalAlignment="Center" ToolTip.Tip="Add a start segment" - Command="{Binding AddStartSegment}" + Command="{CompiledBinding AddStartSegment}" IsVisible="{CompiledBinding ShowAddStart}"> @@ -56,7 +56,7 @@ @@ -66,7 +66,7 @@ Classes="AppBarButton icon-button icon-button-small" VerticalAlignment="Center" ToolTip.Tip="Add an end segment" - Command="{Binding AddEndSegment}" + Command="{CompiledBinding AddEndSegment}" IsVisible="{CompiledBinding ShowAddEnd}"> diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml index b58b57539..a121edb07 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml @@ -22,7 +22,7 @@ - + @@ -39,7 +39,7 @@ @@ -48,7 +48,7 @@ Name="AddMainSegment" Classes="AppBarButton icon-button icon-button-small" ToolTip.Tip="Add main segment" - Command="{Binding AddMainSegment}" + Command="{CompiledBinding AddMainSegment}" IsVisible="{CompiledBinding ShowAddMain}"> diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml index b003a3401..5f78cb52e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:properties="clr-namespace:Artemis.UI.Screens.ProfileEditor.Properties" xmlns:timeline="clr-namespace:Artemis.UI.Screens.ProfileEditor.Properties.Timeline" + xmlns:system="clr-namespace:System;assembly=netstandard" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.ProfileEditor.Properties.Timeline.TimelineGroupView" x:DataType="timeline:TimelineGroupViewModel"> @@ -19,8 +20,8 @@ - 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 76f2b6cd4..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,7 +10,7 @@ x:DataType="timeline:TimelineViewModel"> - + 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 849f556e6..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"> - + - + - + \ 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 16b1c867c..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" @@ -40,9 +41,9 @@ - @@ -52,7 +53,7 @@ - + @@ -60,9 +61,9 @@ - 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 2caea8d00..aac7dafea 100644 --- a/src/Artemis.UI/Screens/Root/RootView.axaml +++ b/src/Artemis.UI/Screens/Root/RootView.axaml @@ -4,8 +4,10 @@ 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"> - + diff --git a/src/Artemis.UI/Screens/Settings/SettingsView.axaml b/src/Artemis.UI/Screens/Settings/SettingsView.axaml index 8009344d7..386c31d3c 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsView.axaml +++ b/src/Artemis.UI/Screens/Settings/SettingsView.axaml @@ -10,7 +10,7 @@ - + diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml index 00014fa1e..a407de94a 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml @@ -4,6 +4,8 @@ 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"> @@ -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}}"> - + @@ -78,9 +80,9 @@ 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}}"> - + @@ -106,9 +108,9 @@ 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}}"> - + @@ -134,9 +136,9 @@ 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}}"> - + diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml index 8c50f252d..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/StartupWizard/Steps/DevicesStep.axaml b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml index ae37209bb..49ac924a0 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml @@ -28,7 +28,7 @@ - + diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml index 6422e2508..5c9df872f 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml @@ -31,7 +31,7 @@ Grid.Column="1" VerticalAlignment="Top" Classes="subtitle" - Text="{Binding Version}" /> + Text="{CompiledBinding Version}" /> - + @@ -64,13 +64,13 @@ - + - + - + diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml index 197f4f354..8fe19c727 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml @@ -19,12 +19,12 @@ diff --git a/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml b/src/Artemis.VisualScripting/Nodes/Operators/Screens/EnumEqualsNodeCustomView.axaml index ef9b82c8e..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 @@ - +