diff --git a/src/Artemis.Core/MVVM/CorePropertyChanged.cs b/src/Artemis.Core/MVVM/CorePropertyChanged.cs index 5e7b6b417..507d09a52 100644 --- a/src/Artemis.Core/MVVM/CorePropertyChanged.cs +++ b/src/Artemis.Core/MVVM/CorePropertyChanged.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; -using Artemis.Core.Properties; +using JetBrains.Annotations; namespace Artemis.Core; diff --git a/src/Artemis.Core/Plugins/Settings/PluginSetting.cs b/src/Artemis.Core/Plugins/Settings/PluginSetting.cs index a29022959..cd94e48d6 100644 --- a/src/Artemis.Core/Plugins/Settings/PluginSetting.cs +++ b/src/Artemis.Core/Plugins/Settings/PluginSetting.cs @@ -1,6 +1,4 @@ using System; -using System.Diagnostics.CodeAnalysis; -using Artemis.Core.Properties; using Artemis.Storage.Entities.Plugins; using Artemis.Storage.Repositories.Interfaces; using Newtonsoft.Json; @@ -36,9 +34,7 @@ public class PluginSetting : CorePropertyChanged, IPluginSetting /// /// The value of the setting /// - [AllowNull] - [CanBeNull] - public T Value + public T? Value { get => _value; set diff --git a/src/Artemis.Core/VisualScripting/NodeScript.cs b/src/Artemis.Core/VisualScripting/NodeScript.cs index 7a02555ac..7672f3504 100644 --- a/src/Artemis.Core/VisualScripting/NodeScript.cs +++ b/src/Artemis.Core/VisualScripting/NodeScript.cs @@ -4,8 +4,8 @@ using System.Collections.ObjectModel; using System.Linq; using Artemis.Core.Events; using Artemis.Core.Internal; -using Artemis.Core.Properties; using Artemis.Storage.Entities.Profile.Nodes; +using JetBrains.Annotations; namespace Artemis.Core; diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs index 72189df57..b751bc6cb 100644 --- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs +++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs @@ -122,7 +122,7 @@ public class DeviceVisualizer : Control private Rect MeasureDevice() { if (Device == null) - return new Rect(0, 0, 0, 0); + return new Rect(); Rect deviceRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height); Geometry geometry = new RectangleGeometry(deviceRect); diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs index cec9f62bb..d2737744f 100644 --- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs +++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml.cs @@ -56,7 +56,6 @@ public partial class DraggableNumberBox : UserControl /// public static readonly StyledProperty SuffixProperty = AvaloniaProperty.Register(nameof(Suffix)); - private readonly NumberBox _numberBox; private TextBox? _inputTextBox; private double _lastX; private bool _moved; @@ -69,8 +68,7 @@ public partial class DraggableNumberBox : UserControl public DraggableNumberBox() { InitializeComponent(); - _numberBox = this.Get("NumberBox"); - _numberBox.Value = Value; + NumberBox.Value = Value; PointerPressed += OnPointerPressed; PointerMoved += OnPointerMoved; @@ -167,11 +165,11 @@ public partial class DraggableNumberBox : UserControl private void SetNumberBoxValue(double value) { - if (!(Math.Abs(_numberBox.Value - Value) > 0.00001)) + if (!(Math.Abs(NumberBox.Value - Value) > 0.00001)) return; _updating = true; - _numberBox.Value = Value; + NumberBox.Value = Value; _updating = false; } @@ -189,7 +187,7 @@ public partial class DraggableNumberBox : UserControl private void OnPointerPressed(object? sender, PointerPressedEventArgs e) { PointerPoint point = e.GetCurrentPoint(this); - _inputTextBox = _numberBox.FindDescendantOfType(); + _inputTextBox = NumberBox.FindDescendantOfType(); _moved = false; _startX = point.Position.X; _lastX = point.Position.X; @@ -261,17 +259,17 @@ public partial class DraggableNumberBox : UserControl if (args.NewValue < Minimum) { - _numberBox.Value = Minimum; + NumberBox.Value = Minimum; return; } if (args.NewValue > Maximum) { - _numberBox.Value = Maximum; + NumberBox.Value = Maximum; return; } - if (Math.Abs(Value - _numberBox.Value) > 0.00001) - Value = _numberBox.Value; + if (Math.Abs(Value - NumberBox.Value) > 0.00001) + Value = NumberBox.Value; } } \ No newline at end of file diff --git a/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs b/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs index 912803902..3276d8d17 100644 --- a/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs +++ b/src/Artemis.UI/Behaviors/TreeItemDragBehavior.cs @@ -138,8 +138,8 @@ public class TreeItemDragBehavior : Behavior if (_itemsControl is not null) { - for (int i = 0; i < _itemsControl.ItemCount; i++) - SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), true); + foreach (Control realizedContainer in _itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(realizedContainer, true); } if (_dragStarted) @@ -147,8 +147,10 @@ public class TreeItemDragBehavior : Behavior MoveDraggedItem(_itemsControl, _draggedIndex, _targetIndex); if (_itemsControl is not null) - for (int i = 0; i < _itemsControl.ItemCount; i++) - SetDraggingPseudoClasses(_itemsControl.ContainerFromIndex(i), false); + { + foreach (Control realizedContainer in _itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(realizedContainer, false); + } if (_draggedContainer is not null) SetDraggingPseudoClasses(_draggedContainer, false); @@ -166,17 +168,9 @@ public class TreeItemDragBehavior : Behavior { if (itemsControl?.Items is null) return; - - int i = 0; - - foreach (object? _ in itemsControl.Items) - { - Control? container = itemsControl.ContainerFromIndex(i); - if (container is not null) - SetTranslateTransform(container, 0, 0); - - i++; - } + + foreach (Control container in itemsControl.GetRealizedContainers()) + SetTranslateTransform(container, 0, 0); } private void RemoveTransforms(ItemsControl? itemsControl) @@ -184,16 +178,8 @@ public class TreeItemDragBehavior : Behavior if (itemsControl?.Items is null) return; - int i = 0; - - foreach (object? _ in itemsControl.Items) - { - Control? container = itemsControl.ContainerFromIndex(i); - if (container is not null) - SetTranslateTransform(container, 0, 0); - - i++; - } + foreach (Control container in itemsControl.GetRealizedContainers()) + SetTranslateTransform(container, 0, 0); } private void MoveDraggedItem(ItemsControl? itemsControl, int draggedIndex, int targetIndex) @@ -264,17 +250,11 @@ public class TreeItemDragBehavior : Behavior double draggedDeltaEnd = orientation == Orientation.Horizontal ? draggedBounds.X + delta + draggedBounds.Width : draggedBounds.Y + delta + draggedBounds.Height; - - int i = 0; - - foreach (object? _ in _itemsControl.Items) + + foreach (Control targetContainer in _itemsControl.GetRealizedContainers()) { - Control? targetContainer = _itemsControl.ContainerFromIndex(i); - if (targetContainer?.RenderTransform is null || ReferenceEquals(targetContainer, _draggedContainer)) - { - i++; + if (targetContainer.RenderTransform is null || ReferenceEquals(targetContainer, _draggedContainer)) continue; - } // If the target container has children, there are two options // Move into the top of the container @@ -287,7 +267,7 @@ public class TreeItemDragBehavior : Behavior ? targetBounds.X + targetBounds.Width / 2 : targetBounds.Y + targetBounds.Height / 2; - int targetIndex = _itemsControl.ItemContainerGenerator.IndexFromContainer(targetContainer); + int targetIndex = _itemsControl.IndexFromContainer(targetContainer); if (targetStart > draggedStart && draggedDeltaEnd >= targetMid) { @@ -316,8 +296,6 @@ public class TreeItemDragBehavior : Behavior else SetTranslateTransform(targetContainer, 0, 0); } - - i++; } } } diff --git a/src/Artemis.UI/DryIoc/ContainerExtensions.cs b/src/Artemis.UI/DryIoc/ContainerExtensions.cs index 9a4095b20..9d63bb539 100644 --- a/src/Artemis.UI/DryIoc/ContainerExtensions.cs +++ b/src/Artemis.UI/DryIoc/ContainerExtensions.cs @@ -1,7 +1,6 @@ using System.Reflection; using Artemis.UI.DryIoc.Factories; using Artemis.UI.DryIoc.InstanceProviders; -using Artemis.UI.Screens; using Artemis.UI.Screens.VisualScripting; using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Updating; @@ -9,7 +8,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.ProfileEditor; using Avalonia.Platform; -using Avalonia.Shared.PlatformSupport; using DryIoc; namespace Artemis.UI.DryIoc; diff --git a/src/Artemis.UI/Screens/Debugger/DebugView.axaml b/src/Artemis.UI/Screens/Debugger/DebugView.axaml index 6387ce994..2bc369cab 100644 --- a/src/Artemis.UI/Screens/Debugger/DebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/DebugView.axaml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs index 37f190fff..b201fca80 100644 --- a/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/DebugView.axaml.cs @@ -10,7 +10,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Debugger; -public class DebugView : ReactiveAppWindow +public partial class DebugView : ReactiveAppWindow { public DebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs index 0e304fc6e..11ae2e1e1 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/DataModel/DataModelDebugView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.DataModel; -public class DataModelDebugView : ReactiveUserControl +public partial class DataModelDebugView : ReactiveUserControl { public DataModelDebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml index db82a857f..bffe6621c 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Logs/LogsDebugView.axaml @@ -8,7 +8,7 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.Debugger.Logs.LogsDebugView" x:DataType="logs:LogsDebugViewModel"> - +public partial class LogsDebugView : ReactiveUserControl { private int _lineCount; - private TextEditor? _textEditor; public LogsDebugView() { @@ -25,25 +18,22 @@ public class LogsDebugView : ReactiveUserControl private void InitializeComponent() { AvaloniaXamlLoader.Load(this); - _textEditor = this.FindControl("log"); } protected override void OnInitialized() { base.OnInitialized(); - Dispatcher.UIThread.Post(() => _textEditor?.ScrollToEnd(), DispatcherPriority.ApplicationIdle); + Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); } private void OnTextChanged(object? sender, EventArgs e) { - if (_textEditor is null) - return; - if (_textEditor.ExtentHeight == 0) + if (LogTextEditor.ExtentHeight == 0) return; - int linesAdded = _textEditor.LineCount - _lineCount; - double lineHeight = _textEditor.ExtentHeight / _textEditor.LineCount; - double outOfScreenTextHeight = _textEditor.ExtentHeight - _textEditor.VerticalOffset - _textEditor.ViewportHeight; + int linesAdded = LogTextEditor.LineCount - _lineCount; + double lineHeight = LogTextEditor.ExtentHeight / LogTextEditor.LineCount; + double outOfScreenTextHeight = LogTextEditor.ExtentHeight - LogTextEditor.VerticalOffset - LogTextEditor.ViewportHeight; double outOfScreenLines = outOfScreenTextHeight / lineHeight; //we need this help distance because of rounding. @@ -61,8 +51,8 @@ public class LogsDebugView : ReactiveUserControl //mess with anything. if (_lineCount == 0 || linesAdded + GRACE_DISTANCE > outOfScreenLines) { - Dispatcher.UIThread.Post(() => _textEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); - _lineCount = _textEditor.LineCount; + Dispatcher.UIThread.Post(() => LogTextEditor.ScrollToEnd(), DispatcherPriority.ApplicationIdle); + _lineCount = LogTextEditor.LineCount; } } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs index bbf87d5e8..230f1b7bb 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugPluginView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Debugger.Performance; -public class PerformanceDebugPluginView : UserControl +public partial class PerformanceDebugPluginView : UserControl { public PerformanceDebugPluginView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs index d94cb0ea3..2f0e76a86 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugProfilerView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Debugger.Performance; -public class PerformanceDebugProfilerView : UserControl +public partial class PerformanceDebugProfilerView : UserControl { public PerformanceDebugProfilerView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs index 572e1b766..9f5da4e78 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.Performance; -public class PerformanceDebugView : ReactiveUserControl +public partial class PerformanceDebugView : ReactiveUserControl { public PerformanceDebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs index 0029dbaa5..90cebc19c 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Render/RenderDebugView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.Render; -public class RenderDebugView : ReactiveUserControl +public partial class RenderDebugView : ReactiveUserControl { public RenderDebugView() { diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs b/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs index c146008aa..e9eddd054 100644 --- a/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Debugger/Tabs/Settings/DebugSettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Debugger.Settings; -public class DebugSettingsView : ReactiveUserControl +public partial class DebugSettingsView : ReactiveUserControl { public DebugSettingsView() { diff --git a/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs b/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs index 680126890..d9fdba4a3 100644 --- a/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/DeviceDetectInputView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceDetectInputView : ReactiveUserControl +public partial class DeviceDetectInputView : ReactiveUserControl { public DeviceDetectInputView() { diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml index 4cc1f6a55..e883d00a6 100644 --- a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml +++ b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml @@ -1,10 +1,10 @@ - - + - + @@ -71,5 +71,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs index a26b2a9c9..ace12c0f7 100644 --- a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml.cs @@ -7,7 +7,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Device; -public class DevicePropertiesView : ReactiveAppWindow +public partial class DevicePropertiesView : ReactiveAppWindow { public DevicePropertiesView() { diff --git a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml index 0cd809679..b3f5fe049 100644 --- a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml +++ b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml @@ -36,8 +36,8 @@ - - + + @@ -50,8 +50,8 @@ - - + + diff --git a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs index 50881c918..ee9a638e4 100644 --- a/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/DeviceSettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceSettingsView : ReactiveUserControl +public partial class DeviceSettingsView : ReactiveUserControl { public DeviceSettingsView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs index ce1b36821..069905527 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceInfoTabView : ReactiveUserControl +public partial class DeviceInfoTabView : ReactiveUserControl { public DeviceInfoTabView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs index 540f47f26..79d4a99ac 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DeviceLedsTabView : ReactiveUserControl +public partial class DeviceLedsTabView : ReactiveUserControl { public DeviceLedsTabView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs index 6a7374f55..1c3632b0f 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DeviceLogicalLayoutDialogView.axaml.cs @@ -8,17 +8,15 @@ using Avalonia.Threading; namespace Artemis.UI.Screens.Device; -public class DeviceLogicalLayoutDialogView : ReactiveUserControl +public partial class DeviceLogicalLayoutDialogView : ReactiveUserControl { private readonly AutoCompleteBox _autoCompleteBox; public DeviceLogicalLayoutDialogView() { InitializeComponent(); - - _autoCompleteBox = this.Get("RegionsAutoCompleteBox"); - _autoCompleteBox.ItemFilter += SearchRegions; - + + RegionsAutoCompleteBox.ItemFilter += SearchRegions; Dispatcher.UIThread.InvokeAsync(DelayedAutoFocus); } diff --git a/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs index 06de8bbc0..516f68a2f 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DevicePhysicalLayoutDialogView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DevicePhysicalLayoutDialogView : ReactiveUserControl +public partial class DevicePhysicalLayoutDialogView : ReactiveUserControl { public DevicePhysicalLayoutDialogView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs index 44cb3cf46..aed405ee1 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class DevicePropertiesTabView : ReactiveUserControl +public partial class DevicePropertiesTabView : ReactiveUserControl { public DevicePropertiesTabView() { diff --git a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs index da7275845..329426b27 100644 --- a/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Device; -public class InputMappingsTabView : ReactiveUserControl +public partial class InputMappingsTabView : ReactiveUserControl { public InputMappingsTabView() { diff --git a/src/Artemis.UI/Screens/Home/HomeView.axaml.cs b/src/Artemis.UI/Screens/Home/HomeView.axaml.cs index 43f3bf653..462c033fe 100644 --- a/src/Artemis.UI/Screens/Home/HomeView.axaml.cs +++ b/src/Artemis.UI/Screens/Home/HomeView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Home; -public class HomeView : ReactiveUserControl +public partial class HomeView : ReactiveUserControl { public HomeView() { diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs index b46a9cd9d..4b8efec20 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisitesInstallDialogView : ReactiveUserControl +public partial class PluginPrerequisitesInstallDialogView : ReactiveUserControl { public PluginPrerequisitesInstallDialogView() { diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs index b2a698040..a8de70fbd 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesInstallDialogViewModel.cs @@ -11,6 +11,7 @@ using Artemis.UI.DryIoc.Factories; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Avalonia.Threading; +using FluentAvalonia.Core; using FluentAvalonia.UI.Controls; using ReactiveUI; using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton; @@ -98,7 +99,7 @@ public class PluginPrerequisitesInstallDialogViewModel : ContentDialogViewModelB private async Task ExecuteInstall() { - ContentDialogClosingDeferral? deferral = null; + Deferral? deferral = null; if (ContentDialog != null) ContentDialog.Closing += (_, args) => deferral = args.GetDeferral(); diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs index ee9196f83..83ede62ab 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisitesUninstallDialogView : ReactiveUserControl +public partial class PluginPrerequisitesUninstallDialogView : ReactiveUserControl { public PluginPrerequisitesUninstallDialogView() { diff --git a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs index 5bbd3e44d..b65e72d23 100644 --- a/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs +++ b/src/Artemis.UI/Screens/Plugins/Dialogs/PluginPrerequisitesUninstallDialogViewModel.cs @@ -12,6 +12,7 @@ using Artemis.UI.DryIoc.Factories; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Avalonia.Threading; +using FluentAvalonia.Core; using FluentAvalonia.UI.Controls; using ReactiveUI; using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton; @@ -83,7 +84,7 @@ public class PluginPrerequisitesUninstallDialogViewModel : ContentDialogViewMode private async Task ExecuteUninstall() { - ContentDialogClosingDeferral? deferral = null; + Deferral? deferral = null; if (ContentDialog != null) ContentDialog.Closing += (_, args) => deferral = args.GetDeferral(); diff --git a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs index 3b8f761eb..5f032736e 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginFeatureView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginFeatureView : ReactiveUserControl +public partial class PluginFeatureView : ReactiveUserControl { public PluginFeatureView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs index 20e155f36..fe8bbc354 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginPlatformView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Plugins; -public class PluginPlatformView : UserControl +public partial class PluginPlatformView : UserControl { public PluginPlatformView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs index e8a86a27e..1d52f9350 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteActionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisiteActionView : UserControl +public partial class PluginPrerequisiteActionView : UserControl { public PluginPrerequisiteActionView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs index 3ba622127..dd0d0f3e6 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginPrerequisiteView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginPrerequisiteView : ReactiveUserControl +public partial class PluginPrerequisiteView : ReactiveUserControl { public PluginPrerequisiteView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs index 7f0608689..47c7d5b99 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginSettingsView : ReactiveUserControl +public partial class PluginSettingsView : ReactiveUserControl { public PluginSettingsView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml index f653027b5..12dd5b763 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml @@ -1,17 +1,17 @@ - - + + - - - + + + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs index 626105c3e..8b1bf702f 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/Plugins/PluginSettingsWindowView.axaml.cs @@ -8,7 +8,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Plugins; -public class PluginSettingsWindowView : ReactiveAppWindow +public partial class PluginSettingsWindowView : ReactiveAppWindow { public PluginSettingsWindowView() { diff --git a/src/Artemis.UI/Screens/Plugins/PluginView.axaml b/src/Artemis.UI/Screens/Plugins/PluginView.axaml index b16c1fd06..27c47a631 100644 --- a/src/Artemis.UI/Screens/Plugins/PluginView.axaml +++ b/src/Artemis.UI/Screens/Plugins/PluginView.axaml @@ -47,8 +47,8 @@ - - + + @@ -81,8 +81,8 @@ - - + + +public partial class PluginView : ReactiveUserControl { - private readonly CheckBox _enabledToggle; - public PluginView() { InitializeComponent(); - _enabledToggle = this.Find("EnabledToggle"); - _enabledToggle.Click += EnabledToggleOnClick; + EnabledToggle.Click += EnabledToggleOnClick; } private void InitializeComponent() diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs index 99520854f..d9875515d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/AlwaysOnConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class AlwaysOnConditionView : UserControl +public partial class AlwaysOnConditionView : UserControl { public AlwaysOnConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs index b9bfdfd71..c4a74eed0 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class EventConditionView : ReactiveUserControl +public partial class EventConditionView : ReactiveUserControl { public EventConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs index 7333571c8..fbd8eea25 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/EventConditionViewModel.cs @@ -1,4 +1,5 @@ using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; @@ -8,7 +9,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs index 39b606054..8e756172c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/PlayOnceConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class PlayOnceConditionView : UserControl +public partial class PlayOnceConditionView : UserControl { public PlayOnceConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs index 83855685c..fe6a7262f 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/ConditionTypes/StaticConditionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition.ConditionTypes; -public class StaticConditionView : ReactiveUserControl +public partial class StaticConditionView : ReactiveUserControl { public StaticConditionView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs index 730ad046a..fbd7e2c41 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition; -public class DisplayConditionScriptView : ReactiveUserControl +public partial class DisplayConditionScriptView : ReactiveUserControl { public DisplayConditionScriptView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs index 87b0a3104..edc771a93 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/DisplayCondition/DisplayConditionScriptViewModel.cs @@ -1,12 +1,12 @@ using System.Collections.ObjectModel; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.DryIoc.Factories; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.DisplayCondition; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs index eedb4560a..f60548ce3 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/MenuBar/MenuBarView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.MenuBar; -public class MenuBarView : ReactiveUserControl +public partial class MenuBarView : ReactiveUserControl { public MenuBarView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs index d94c76117..0c3cec9a2 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Playback/PlaybackView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Playback; -public class PlaybackView : ReactiveUserControl +public partial class PlaybackView : ReactiveUserControl { public PlaybackView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs index 79c456926..740da8dc6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Behaviors/ProfileTreeViewDropHandler.cs @@ -15,7 +15,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase { public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { - if (e.Source is IControl && sender is TreeView treeView) + if (e.Source is Control && sender is TreeView treeView) return Validate(treeView, e, sourceContext, targetContext, false); return false; @@ -24,7 +24,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { bool result = false; - if (e.Source is IControl && sender is TreeView treeView) + if (e.Source is Control && sender is TreeView treeView) result = Validate(treeView, e, sourceContext, targetContext, true); if (sender is ItemsControl itemsControl) @@ -46,8 +46,8 @@ public class ProfileTreeViewDropHandler : DropHandlerBase private bool Validate(TreeView treeView, DragEventArgs e, object? sourceContext, object? targetContext, bool bExecute) where T : TreeItemViewModel { Point position = e.GetPosition(treeView); - IVisual? targetVisual = treeView.GetVisualAt(position).FindAncestorOfType(); - if (sourceContext is not T sourceNode || targetContext is not ProfileTreeViewModel vm || targetVisual is not IControl {DataContext: T targetNode}) + TreeViewItem? targetVisual = treeView.GetVisualAt(position).FindAncestorOfType(); + if (sourceContext is not T sourceNode || targetContext is not ProfileTreeViewModel vm || targetVisual is not Control {DataContext: T targetNode}) return false; if (bExecute && targetNode == sourceNode) return false; @@ -69,7 +69,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase } else { - IVisual? header = targetVisual.GetVisualDescendants().FirstOrDefault(d => d is Border b && b.Name == "PART_LayoutRoot"); + Visual? header = targetVisual.GetVisualDescendants().FirstOrDefault(d => d is Border b && b.Name == "PART_LayoutRoot"); if (header != null) { position = e.GetPosition(header); @@ -119,7 +119,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase } else { - SetDraggingPseudoClasses((IControl) targetVisual, dropType); + SetDraggingPseudoClasses(targetVisual, dropType); } return true; @@ -129,12 +129,12 @@ public class ProfileTreeViewDropHandler : DropHandlerBase { List result = new(); - foreach (ItemContainerInfo containerInfo in currentNode.ItemContainerGenerator.Containers) + foreach (Control containerControl in currentNode.GetRealizedContainers()) { - if (containerInfo.ContainerControl is TreeViewItem treeViewItem && containerInfo.Item is TreeItemViewModel) + if (containerControl is TreeViewItem treeViewItem && containerControl.DataContext is TreeItemViewModel) { result.Add(treeViewItem); - if (treeViewItem.ItemContainerGenerator.Containers.Any()) + if (treeViewItem.ItemCount > 0) result.AddRange(GetFlattenedTreeView(treeViewItem)); } } @@ -142,7 +142,7 @@ public class ProfileTreeViewDropHandler : DropHandlerBase return result; } - private void SetDraggingPseudoClasses(IControl control, TreeDropType type) + private void SetDraggingPseudoClasses(TreeViewItem control, TreeDropType type) { if (type == TreeDropType.None) { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs index 884346e0b..bb65355de 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/CategoryAdaptionHintView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; -public class CategoryAdaptionHintView : UserControl +public partial class CategoryAdaptionHintView : UserControl { public CategoryAdaptionHintView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs index f2ec263d3..68ab025ba 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/DeviceAdaptionHintView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; -public class DeviceAdaptionHintView : UserControl +public partial class DeviceAdaptionHintView : UserControl { public DeviceAdaptionHintView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs index 1fcb02a6d..e7db0abdd 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/AdaptionHints/KeyboardSectionAdaptionHintView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; -public class KeyboardSectionAdaptionHintView : UserControl +public partial class KeyboardSectionAdaptionHintView : UserControl { public KeyboardSectionAdaptionHintView() { 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 50afd41b8..1ff26bba4 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml @@ -1,10 +1,11 @@ - - - + + @@ -87,12 +88,12 @@ - + Add hint - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs index e3454e44e..a406a063c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs; -public class LayerHintsDialogView : ReactiveAppWindow +public partial class LayerHintsDialogView : ReactiveAppWindow { public LayerHintsDialogView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs index bb33b620b..41514aa0e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/Dialogs/LayerHintsDialogViewModel.cs @@ -1,13 +1,13 @@ using System; using System.Collections.ObjectModel; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.DryIoc.Factories; using Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs.AdaptionHints; using Artemis.UI.Shared; -using Avalonia.Controls.Mixins; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs index 43f36534b..5fed64811 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemView.axaml.cs @@ -9,7 +9,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree; -public class FolderTreeItemView : ReactiveUserControl +public partial class FolderTreeItemView : ReactiveUserControl { public FolderTreeItemView() { @@ -18,8 +18,8 @@ public class FolderTreeItemView : ReactiveUserControl { ViewModel?.Rename.Subscribe(_ => { - this.Get("Input").Focus(); - this.Get("Input").SelectAll(); + Input.Focus(); + Input.SelectAll(); }).DisposeWith(d); }); } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs index e34cef5cb..c912738fb 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemView.axaml.cs @@ -9,7 +9,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree; -public class LayerTreeItemView : ReactiveUserControl +public partial class LayerTreeItemView : ReactiveUserControl { public LayerTreeItemView() { @@ -18,8 +18,8 @@ public class LayerTreeItemView : ReactiveUserControl { ViewModel?.Rename.Subscribe(_ => { - this.Get("Input").Focus(); - this.Get("Input").SelectAll(); + Input.Focus(); + Input.SelectAll(); }).DisposeWith(d); }); } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs index d519466b3..101a9dd1f 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml.cs @@ -13,9 +13,8 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.ProfileTree; -public class ProfileTreeView : ReactiveUserControl +public partial class ProfileTreeView : ReactiveUserControl { - private readonly TreeView _treeView; private Image? _dragAdorner; private Point _dragStartPosition; private Point _elementDragOffset; @@ -23,11 +22,10 @@ public class ProfileTreeView : ReactiveUserControl public ProfileTreeView() { InitializeComponent(); - _treeView = this.Get("ProfileTreeView"); AddHandler(DragDrop.DragEnterEvent, HandleDragEnterEvent, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); AddHandler(DragDrop.DragOverEvent, HandleDragOver, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - AddHandler(PointerEnterEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + AddHandler(PointerEnteredEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); } private void HandlePointerEnter(object? sender, PointerEventArgs e) @@ -122,6 +120,6 @@ public class ProfileTreeView : ReactiveUserControl private void ProfileTreeView_OnSelectionChanged(object? sender, SelectionChangedEventArgs e) { - _treeView.Focus(); + ProfileTreeView.Focus(); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs index d38d4272f..2888b4271 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.DataBinding; -public class DataBindingView : ReactiveUserControl +public partial class DataBindingView : ReactiveUserControl { public DataBindingView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs index 77b18f314..40782dd0d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/AddEffectView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Dialogs; -public class AddEffectView : ReactiveUserControl +public partial class AddEffectView : ReactiveUserControl { public AddEffectView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs index fb0f6d893..72e19028c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Dialogs/TimelineSegmentEditView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Dialogs; -public class TimelineSegmentEditView : ReactiveUserControl +public partial class TimelineSegmentEditView : ReactiveUserControl { public TimelineSegmentEditView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs index 602eb1424..e2a45f734 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/PropertiesView.axaml.cs @@ -1,8 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; -using Avalonia.Controls; -using Avalonia.Controls.Shapes; +using Avalonia; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; @@ -10,16 +9,11 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.Properties; -public class PropertiesView : ReactiveUserControl +public partial class PropertiesView : ReactiveUserControl { - private readonly Polygon _timelineCaret; - private readonly Line _timelineLine; - public PropertiesView() { InitializeComponent(); - _timelineCaret = this.Get("TimelineCaret"); - _timelineLine = this.Get("TimelineLine"); } private void InitializeComponent() @@ -58,12 +52,12 @@ public class PropertiesView : ReactiveUserControl if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed || ViewModel == null) return; - IInputElement? senderElement = (IInputElement?) sender; + Visual? senderElement = (Visual?) sender; if (senderElement == null) return; // Get the parent grid, need that for our position - IVisual? parent = senderElement.VisualParent; + Visual? parent = senderElement.GetVisualParent(); double x = Math.Max(0, e.GetPosition(parent).X); TimeSpan newTime = TimeSpan.FromSeconds(x / ViewModel.PixelsPerSecond); newTime = RoundTime(newTime); @@ -84,11 +78,11 @@ public class PropertiesView : ReactiveUserControl private void TimelineHeader_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || sender is not IInputElement senderElement) + if (ViewModel == null || sender is not Visual senderElement) return; // Get the parent grid, need that for our position - double x = Math.Max(0, e.GetPosition(senderElement.VisualParent).X); + double x = Math.Max(0, e.GetPosition(senderElement.GetVisualParent()).X); TimeSpan newTime = TimeSpan.FromSeconds(x / ViewModel.PixelsPerSecond); ViewModel.TimelineViewModel.ChangeTime(RoundTime(newTime)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs index fa1d2f160..3f44be6ea 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineEasingView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes; -public class TimelineEasingView : UserControl +public partial class TimelineEasingView : UserControl { public TimelineEasingView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs index ea1a6c5ff..307b8bc43 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes; -public class TimelineKeyframeView : ReactiveUserControl +public partial class TimelineKeyframeView : ReactiveUserControl { private bool _moved; private TimelinePropertyView? _timelinePropertyView; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs index 0f5b9607c..712db5216 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Keyframes/TimelineKeyframeViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; @@ -13,7 +14,6 @@ using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Input; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs index 17ec9c101..b298d9315 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentView.axaml.cs @@ -6,15 +6,13 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; -public class EndSegmentView : ReactiveUserControl +public partial class EndSegmentView : ReactiveUserControl { - private readonly Rectangle _keyframeDragAnchor; private double _dragOffset; public EndSegmentView() { InitializeComponent(); - _keyframeDragAnchor = this.Get("KeyframeDragAnchor"); } private void InitializeComponent() @@ -26,7 +24,7 @@ public class EndSegmentView : ReactiveUserControl { if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; - e.Pointer.Capture(_keyframeDragAnchor); + e.Pointer.Capture(KeyframeDragAnchor); _dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X; ViewModel.StartResize(); @@ -34,14 +32,14 @@ public class EndSegmentView : ReactiveUserControl private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; e.Pointer.Capture(null); ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs index 7e10e7999..1d556bb59 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/EndSegmentViewModel.cs @@ -1,10 +1,10 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs index 8c09b98dc..6ec76a3b7 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentView.axaml.cs @@ -6,15 +6,13 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; -public class MainSegmentView : ReactiveUserControl +public partial class MainSegmentView : ReactiveUserControl { - private readonly Rectangle _keyframeDragAnchor; private double _dragOffset; public MainSegmentView() { InitializeComponent(); - _keyframeDragAnchor = this.Get("KeyframeDragAnchor"); } private void InitializeComponent() @@ -26,7 +24,7 @@ public class MainSegmentView : ReactiveUserControl { if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; - e.Pointer.Capture(_keyframeDragAnchor); + e.Pointer.Capture(KeyframeDragAnchor); _dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X; ViewModel.StartResize(); @@ -34,14 +32,14 @@ public class MainSegmentView : ReactiveUserControl private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; e.Pointer.Capture(null); ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs index 15ebb371c..a122bbb56 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/MainSegmentViewModel.cs @@ -1,10 +1,10 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs index 9876e5c6c..37c6b24fa 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentView.axaml.cs @@ -6,15 +6,13 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments; -public class StartSegmentView : ReactiveUserControl +public partial class StartSegmentView : ReactiveUserControl { - private readonly Rectangle _keyframeDragAnchor; private double _dragOffset; public StartSegmentView() { InitializeComponent(); - _keyframeDragAnchor = this.Get("KeyframeDragAnchor"); } private void InitializeComponent() @@ -26,7 +24,7 @@ public class StartSegmentView : ReactiveUserControl { if (ViewModel == null || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed) return; - e.Pointer.Capture(_keyframeDragAnchor); + e.Pointer.Capture(KeyframeDragAnchor); _dragOffset = ViewModel.Width - e.GetCurrentPoint(this).Position.X; ViewModel.StartResize(); @@ -34,14 +32,14 @@ public class StartSegmentView : ReactiveUserControl private void KeyframeDragAnchor_OnPointerMoved(object? sender, PointerEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; ViewModel.UpdateResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void KeyframeDragAnchor_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, _keyframeDragAnchor)) + if (ViewModel == null || !ReferenceEquals(e.Pointer.Captured, KeyframeDragAnchor)) return; e.Pointer.Capture(null); ViewModel.FinishResize(e.GetCurrentPoint(this).Position.X + _dragOffset, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs index fcff6ebc4..de289fb17 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/StartSegmentViewModel.cs @@ -1,4 +1,5 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs index b2d7687f4..f5e39b592 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/Segments/TimelineSegmentViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs index 8999b791a..233cb59ce 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; -public class TimelineGroupView : ReactiveUserControl +public partial class TimelineGroupView : ReactiveUserControl { public TimelineGroupView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs index 5370999e3..620be7f41 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineGroupViewModel.cs @@ -1,8 +1,8 @@ using System; using System.Collections.ObjectModel; +using System.Reactive.Disposables; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Controls.Mixins; using DynamicData; using DynamicData.Binding; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs index 082ad8d15..e025639d6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; -public class TimelinePropertyView : ReactiveUserControl +public partial class TimelinePropertyView : ReactiveUserControl { public TimelinePropertyView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs index 211c91130..4ae156667 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelinePropertyViewModel.cs @@ -2,12 +2,12 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Controls.Mixins; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs index 9b1d11f85..37cf942b9 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineView.axaml.cs @@ -9,17 +9,15 @@ using Avalonia.Controls; using Avalonia.Input; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; +using Avalonia.VisualTree; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; -public class TimelineView : ReactiveUserControl +public partial class TimelineView : ReactiveUserControl { - private readonly SelectionRectangle _selectionRectangle; - public TimelineView() { InitializeComponent(); - _selectionRectangle = this.Get("SelectionRectangle"); } private void InitializeComponent() @@ -34,7 +32,8 @@ public class TimelineView : ReactiveUserControl List keyframeViews = this.GetVisualChildrenOfType().Where(k => { - Rect hitTestRect = k.TransformedBounds != null ? k.TransformedBounds.Value.Bounds.TransformToAABB(k.TransformedBounds.Value.Transform) : Rect.Empty; + TransformedBounds? transformedBounds = k.GetTransformedBounds(); + Rect hitTestRect = transformedBounds != null ? transformedBounds.Value.Bounds.TransformToAABB(transformedBounds.Value.Transform) : new Rect(); return e.AbsoluteRectangle.Intersects(hitTestRect); }).ToList(); @@ -43,7 +42,7 @@ public class TimelineView : ReactiveUserControl private void InputElement_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (_selectionRectangle.IsSelecting) + if (SelectionRectangle.IsSelecting) return; ViewModel?.SelectKeyframes(new List(), false); 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 cc7e0dd4d..ec06ddc2b 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Timeline/TimelineViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Threading.Tasks; using Artemis.Core; @@ -14,7 +15,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Avalonia; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs index 425743459..8b8cb3d54 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/ContentDialogs/LayerEffectRenameView.axaml.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using Artemis.UI.Shared.Extensions; -using Avalonia.Controls; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using Avalonia.Threading; @@ -8,7 +7,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree.ContentDialogs; -public class LayerEffectRenameView : ReactiveUserControl +public partial class LayerEffectRenameView : ReactiveUserControl { public LayerEffectRenameView() { @@ -24,8 +23,8 @@ public class LayerEffectRenameView : ReactiveUserControl("NameTextBox").SelectAll(); - this.Get("NameTextBox").Focus(); + NameTextBox.SelectAll(); + NameTextBox.Focus(); } private void InitializeComponent() diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs index 50927e5d5..7792b8bba 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/Dialogs/LayerBrushPresetView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree.Dialogs; -public class LayerBrushPresetView : ReactiveUserControl +public partial class LayerBrushPresetView : ReactiveUserControl { public LayerBrushPresetView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs index 2e6219049..645d52262 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreeGroupView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree; -public class TreeGroupView : ReactiveUserControl +public partial class TreeGroupView : ReactiveUserControl { public TreeGroupView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs index 4e0354fcf..ce31aec8d 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml.cs @@ -1,9 +1,8 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Avalonia.Controls; -using Avalonia.Controls.Mixins; -using Avalonia.Controls.Primitives; using Avalonia.Interactivity; using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; @@ -11,7 +10,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree; -public class TreePropertyView : ReactiveUserControl +public partial class TreePropertyView : ReactiveUserControl { public TreePropertyView() { @@ -32,6 +31,6 @@ public class TreePropertyView : ReactiveUserControl private void DataBindingToggleButton_OnClick(object? sender, RoutedEventArgs e) { ViewModel?.ToggleCurrentLayerProperty(); - this.Find("DataBindingToggleButton").IsChecked = !this.Find("DataBindingToggleButton").IsChecked; + DataBindingToggleButton.IsChecked = !DataBindingToggleButton.IsChecked; } } \ No newline at end of file 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 983c476ab..ecceb942b 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyViewModel.cs @@ -1,5 +1,6 @@ using System; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Extensions; @@ -7,7 +8,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Artemis.UI.Shared.Services.PropertyInput; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.Properties.Tree; 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 863c6d768..9395cb9a5 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml @@ -1,8 +1,8 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs index 8df8901f9..d01dc274c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/BrushConfigurationWindowView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows; -public class BrushConfigurationWindowView : ReactiveAppWindow +public partial class BrushConfigurationWindowView : ReactiveAppWindow { private bool _canClose; 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 6e6289fd7..a6ef2ccd7 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml @@ -1,8 +1,8 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs index 0fc36eefd..ddee1ec69 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor.Properties.Windows; -public class EffectConfigurationWindowView : ReactiveAppWindow +public partial class EffectConfigurationWindowView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs index 7ada29b7d..c5a82ff9c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.StatusBar; -public class StatusBarView : ReactiveUserControl +public partial class StatusBarView : ReactiveUserControl { public StatusBarView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs index 341aef64c..73327e70a 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarViewModel.cs @@ -1,9 +1,9 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Controls.Mixins; using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.StatusBar; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs index b8938f4f5..77d850ec2 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml.cs @@ -6,7 +6,7 @@ using Avalonia.Skia; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools; -public class SelectionAddToolView : ReactiveUserControl +public partial class SelectionAddToolView : ReactiveUserControl { public SelectionAddToolView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs index 72da9f522..b1bdf7297 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolViewModel.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using Material.Icons; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs index 4a618dd3f..1b14d986c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Skia; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools; -public class SelectionRemoveToolView : ReactiveUserControl +public partial class SelectionRemoveToolView : ReactiveUserControl { public SelectionRemoveToolView() { diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs index 7fde8511e..2c7d0a995 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolViewModel.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; -using Avalonia.Controls.Mixins; using Material.Icons; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs index 26bf273cc..eede83c42 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Reactive.Disposables; using Artemis.Core; using Artemis.UI.Shared.Extensions; using Avalonia; @@ -21,19 +22,9 @@ using SkiaSharp; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Tools; -public class TransformToolView : ReactiveUserControl +public partial class TransformToolView : ReactiveUserControl { - private readonly Grid _handleGrid; private readonly List _handles = new(); - private readonly Panel _resizeBottomCenter; - private readonly Panel _resizeBottomLeft; - private readonly Panel _resizeBottomRight; - private readonly Panel _resizeLeftCenter; - private readonly Panel _resizeRightCenter; - private readonly Panel _resizeTopCenter; - private readonly Panel _resizeTopLeft; - private readonly Panel _resizeTopRight; - private SKPoint _dragOffset; private ZoomBorder? _zoomBorder; @@ -41,31 +32,21 @@ public class TransformToolView : ReactiveUserControl { InitializeComponent(); - _handleGrid = this.Get("HandleGrid"); + _handles.Add(RotateTopLeft); + _handles.Add(RotateTopRight); + _handles.Add(RotateBottomRight); + _handles.Add(RotateBottomLeft); - _handles.Add(this.Get("RotateTopLeft")); - _handles.Add(this.Get("RotateTopRight")); - _handles.Add(this.Get("RotateBottomRight")); - _handles.Add(this.Get("RotateBottomLeft")); + _handles.Add(ResizeTopCenter); + _handles.Add(ResizeRightCenter); + _handles.Add(ResizeBottomCenter); + _handles.Add(ResizeLeftCenter); + _handles.Add(ResizeTopLeft); + _handles.Add(ResizeTopRight); + _handles.Add(ResizeBottomRight); + _handles.Add(ResizeBottomLeft); - _resizeTopCenter = this.Get("ResizeTopCenter"); - _handles.Add(_resizeTopCenter); - _resizeRightCenter = this.Get("ResizeRightCenter"); - _handles.Add(_resizeRightCenter); - _resizeBottomCenter = this.Get("ResizeBottomCenter"); - _handles.Add(_resizeBottomCenter); - _resizeLeftCenter = this.Get("ResizeLeftCenter"); - _handles.Add(_resizeLeftCenter); - _resizeTopLeft = this.Get("ResizeTopLeft"); - _handles.Add(_resizeTopLeft); - _resizeTopRight = this.Get("ResizeTopRight"); - _handles.Add(_resizeTopRight); - _resizeBottomRight = this.Get("ResizeBottomRight"); - _handles.Add(_resizeBottomRight); - _resizeBottomLeft = this.Get("ResizeBottomLeft"); - _handles.Add(_resizeBottomLeft); - - _handles.Add(this.Get("AnchorPoint")); + _handles.Add(AnchorPoint); this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.Rotation).Subscribe(_ => UpdateTransforms()).DisposeWith(d)); } @@ -83,10 +64,10 @@ public class TransformToolView : ReactiveUserControl RotateTransform counterRotate = new(ViewModel.Rotation * -1); // Apply the counter rotation to the containers - foreach (Panel panel in _handleGrid.Children.Where(c => c is Panel and not Canvas).Cast()) + foreach (Panel panel in HandleGrid.Children.Where(c => c is Panel and not Canvas).Cast()) panel.RenderTransform = counterRotate; - foreach (Control control in _handleGrid.GetVisualDescendants().Where(d => d is Control c && c.Classes.Contains("unscaled")).Cast()) + foreach (Control control in HandleGrid.GetVisualDescendants().Where(d => d is Control c && c.Classes.Contains("unscaled")).Cast()) control.RenderTransform = counterScale; } @@ -117,21 +98,21 @@ public class TransformToolView : ReactiveUserControl private TransformToolViewModel.ResizeSide GetResizeDirection(Ellipse element) { - if (ReferenceEquals(element.Parent, _resizeTopLeft)) + if (ReferenceEquals(element.Parent, ResizeTopLeft)) return TransformToolViewModel.ResizeSide.Top | TransformToolViewModel.ResizeSide.Left; - if (ReferenceEquals(element.Parent, _resizeTopRight)) + if (ReferenceEquals(element.Parent, ResizeTopRight)) return TransformToolViewModel.ResizeSide.Top | TransformToolViewModel.ResizeSide.Right; - if (ReferenceEquals(element.Parent, _resizeBottomRight)) + if (ReferenceEquals(element.Parent, ResizeBottomRight)) return TransformToolViewModel.ResizeSide.Bottom | TransformToolViewModel.ResizeSide.Right; - if (ReferenceEquals(element.Parent, _resizeBottomLeft)) + if (ReferenceEquals(element.Parent, ResizeBottomLeft)) return TransformToolViewModel.ResizeSide.Bottom | TransformToolViewModel.ResizeSide.Left; - if (ReferenceEquals(element.Parent, _resizeTopCenter)) + if (ReferenceEquals(element.Parent, ResizeTopCenter)) return TransformToolViewModel.ResizeSide.Top; - if (ReferenceEquals(element.Parent, _resizeRightCenter)) + if (ReferenceEquals(element.Parent, ResizeRightCenter)) return TransformToolViewModel.ResizeSide.Right; - if (ReferenceEquals(element.Parent, _resizeBottomCenter)) + if (ReferenceEquals(element.Parent, ResizeBottomCenter)) return TransformToolViewModel.ResizeSide.Bottom; - if (ReferenceEquals(element.Parent, _resizeLeftCenter)) + if (ReferenceEquals(element.Parent, ResizeLeftCenter)) return TransformToolViewModel.ResizeSide.Left; throw new ArgumentException("Given element is not a child of a resize container"); @@ -310,14 +291,14 @@ public class TransformToolView : ReactiveUserControl private void UpdateCursors() { - _resizeTopCenter.Cursor = GetCursorAtAngle(0f); - _resizeTopRight.Cursor = GetCursorAtAngle(45f); - _resizeRightCenter.Cursor = GetCursorAtAngle(90f); - _resizeBottomRight.Cursor = GetCursorAtAngle(135f); - _resizeBottomCenter.Cursor = GetCursorAtAngle(180f); - _resizeBottomLeft.Cursor = GetCursorAtAngle(225f); - _resizeLeftCenter.Cursor = GetCursorAtAngle(270f); - _resizeTopLeft.Cursor = GetCursorAtAngle(315f); + ResizeTopCenter.Cursor = GetCursorAtAngle(0f); + ResizeTopRight.Cursor = GetCursorAtAngle(45f); + ResizeRightCenter.Cursor = GetCursorAtAngle(90f); + ResizeBottomRight.Cursor = GetCursorAtAngle(135f); + ResizeBottomCenter.Cursor = GetCursorAtAngle(180f); + ResizeBottomLeft.Cursor = GetCursorAtAngle(225f); + ResizeLeftCenter.Cursor = GetCursorAtAngle(270f); + ResizeTopLeft.Cursor = GetCursorAtAngle(315f); } private Cursor GetCursorAtAngle(float angle, bool includeLayerRotation = true) diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs index b5f737603..7475f15eb 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolViewModel.cs @@ -1,5 +1,6 @@ using System; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Exceptions; @@ -7,7 +8,6 @@ using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Material.Icons; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs index 28696008f..78c76513a 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml.cs @@ -2,7 +2,6 @@ using System; using System.Linq; using System.Reactive.Disposables; using Avalonia; -using Avalonia.Controls; using Avalonia.Controls.PanAndZoom; using Avalonia.Input; using Avalonia.Markup.Xaml; @@ -13,19 +12,17 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor; -public class VisualEditorView : ReactiveUserControl +public partial class VisualEditorView : ReactiveUserControl { - private readonly ZoomBorder _zoomBorder; private bool _movedByUser; public VisualEditorView() { InitializeComponent(); - - _zoomBorder = this.Find("ZoomBorder"); - _zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; - _zoomBorder.PointerMoved += ZoomBorderOnPointerMoved; - _zoomBorder.PointerWheelChanged += ZoomBorderOnPointerWheelChanged; + + ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + ZoomBorder.PointerMoved += ZoomBorderOnPointerMoved; + ZoomBorder.PointerWheelChanged += ZoomBorderOnPointerWheelChanged; UpdateZoomBorderBackground(); this.WhenActivated(d => @@ -48,7 +45,7 @@ public class VisualEditorView : ReactiveUserControl private void ZoomBorderOnPointerMoved(object? sender, PointerEventArgs e) { - if (e.GetCurrentPoint(_zoomBorder).Properties.IsMiddleButtonPressed) + if (e.GetCurrentPoint(ZoomBorder).Properties.IsMiddleButtonPressed) _movedByUser = true; } @@ -59,14 +56,14 @@ public class VisualEditorView : ReactiveUserControl private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property.Name == nameof(_zoomBorder.Background)) + if (e.Property.Name == nameof(ZoomBorder.Background)) UpdateZoomBorderBackground(); } private void UpdateZoomBorderBackground() { - if (_zoomBorder.Background is VisualBrush visualBrush) - visualBrush.DestinationRect = new RelativeRect(_zoomBorder.OffsetX * -1, _zoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); + if (ZoomBorder.Background is VisualBrush visualBrush) + visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } private void InitializeComponent() @@ -96,8 +93,8 @@ public class VisualEditorView : ReactiveUserControl double scale = Math.Min(3, Math.Min(Bounds.Width / scriptRect.Width, Bounds.Height / scriptRect.Height)); // Pan and zoom to make the script fit - _zoomBorder.Zoom(scale, 0, 0, skipTransitions); - _zoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); + ZoomBorder.Zoom(scale, 0, 0, skipTransitions); + ZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); _movedByUser = false; } diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs index 3c35220b9..95cc4eca6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerShapeVisualizerView.axaml.cs @@ -1,8 +1,8 @@ using System; using System.Linq; +using System.Reactive.Disposables; using Avalonia; using Avalonia.Controls; -using Avalonia.Controls.Mixins; using Avalonia.Controls.PanAndZoom; using Avalonia.Controls.Shapes; using Avalonia.LogicalTree; @@ -12,18 +12,13 @@ using ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Visualizers; -public class LayerShapeVisualizerView : ReactiveUserControl +public partial class LayerShapeVisualizerView : ReactiveUserControl { - private readonly Path _layerVisualizer; - private readonly Path _layerVisualizerUnbound; private ZoomBorder? _zoomBorder; public LayerShapeVisualizerView() { InitializeComponent(); - _layerVisualizer = this.Get("LayerVisualizer"); - _layerVisualizerUnbound = this.Get("LayerVisualizerUnbound"); - this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.Selected).Subscribe(_ => UpdateStrokeThickness()).DisposeWith(d)); } @@ -66,13 +61,13 @@ public class LayerShapeVisualizerView : ReactiveUserControl +public partial class LayerVisualizerView : ReactiveUserControl { - private readonly Path _layerVisualizer; private ZoomBorder? _zoomBorder; public LayerVisualizerView() { InitializeComponent(); - _layerVisualizer = this.Get("LayerVisualizer"); } private void InitializeComponent() @@ -49,7 +47,7 @@ public class LayerVisualizerView : ReactiveUserControl { if (e.Property != ZoomBorder.ZoomXProperty || _zoomBorder == null) return; - _layerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX); + LayerVisualizer.StrokeThickness = Math.Max(1, 4 / _zoomBorder.ZoomX); } #endregion diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs index 60203a62f..fd6044730 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Visualizers/LayerVisualizerViewModel.cs @@ -1,11 +1,11 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.UI.Shared; using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.ProfileEditor; using Avalonia; -using Avalonia.Controls.Mixins; using ReactiveUI; using SkiaSharp; diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs index 9ac61e1f6..54e33fa6e 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.ProfileEditor; -public class ProfileEditorTitleBarView : UserControl +public partial class ProfileEditorTitleBarView : UserControl { public ProfileEditorTitleBarView() { @@ -15,8 +15,4 @@ public class ProfileEditorTitleBarView : UserControl { AvaloniaXamlLoader.Load(this); } - - private void MenuItem_OnSubmenuOpened(object? sender, RoutedEventArgs e) - { - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs index e745f4d2f..ecdc2dfb8 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.ProfileEditor; -public class ProfileEditorView : ReactiveUserControl +public partial class ProfileEditorView : ReactiveUserControl { public ProfileEditorView() { @@ -27,8 +27,4 @@ public class ProfileEditorView : ReactiveUserControl { AvaloniaXamlLoader.Load(this); } - - private void MenuItem_OnSubmenuOpened(object? sender, RoutedEventArgs e) - { - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs index a4aa18dfc..30a0f787f 100644 --- a/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs +++ b/src/Artemis.UI/Screens/Root/DefaultTitleBarView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Root; -public class DefaultTitleBarView : UserControl +public partial class DefaultTitleBarView : UserControl { public DefaultTitleBarView() { diff --git a/src/Artemis.UI/Screens/Root/RootView.axaml.cs b/src/Artemis.UI/Screens/Root/RootView.axaml.cs index a39ad9af7..b0b5cbf2c 100644 --- a/src/Artemis.UI/Screens/Root/RootView.axaml.cs +++ b/src/Artemis.UI/Screens/Root/RootView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Root; -public class RootView : ReactiveUserControl +public partial class RootView : ReactiveUserControl { public RootView() { diff --git a/src/Artemis.UI/Screens/Root/SplashView.axaml.cs b/src/Artemis.UI/Screens/Root/SplashView.axaml.cs index a48cd245f..954265d1d 100644 --- a/src/Artemis.UI/Screens/Root/SplashView.axaml.cs +++ b/src/Artemis.UI/Screens/Root/SplashView.axaml.cs @@ -9,7 +9,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Root; -public class SplashView : ReactiveWindow +public partial class SplashView : ReactiveWindow { public SplashView() { diff --git a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs index 06c18583a..56dc931c5 100644 --- a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationCreateView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Scripting.Dialogs; -public class ScriptConfigurationCreateView : ReactiveUserControl +public partial class ScriptConfigurationCreateView : ReactiveUserControl { public ScriptConfigurationCreateView() { diff --git a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs index df99ad942..291cbaa3b 100644 --- a/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/Dialogs/ScriptConfigurationEditView.axaml.cs @@ -1,19 +1,18 @@ -using Avalonia.Controls; -using Avalonia.Markup.Xaml; +using Avalonia.Markup.Xaml; using Avalonia.ReactiveUI; using ReactiveUI; namespace Artemis.UI.Screens.Scripting.Dialogs; -public class ScriptConfigurationEditView : ReactiveUserControl +public partial class ScriptConfigurationEditView : ReactiveUserControl { public ScriptConfigurationEditView() { InitializeComponent(); this.WhenActivated(_ => { - this.Get("Input").Focus(); - this.Get("Input").SelectAll(); + Input.Focus(); + Input.SelectAll(); }); } diff --git a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml index 68975d579..22f4d5c00 100644 --- a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml +++ b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml @@ -1,11 +1,11 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs index fc6a8787b..dd6e5150b 100644 --- a/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs +++ b/src/Artemis.UI/Screens/Scripting/ScriptsDialogView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Scripting; -public class ScriptsDialogView : ReactiveAppWindow +public partial class ScriptsDialogView : ReactiveAppWindow { private bool _canClose; diff --git a/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs b/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs index f7f6c2781..7d34789ae 100644 --- a/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/SettingsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class SettingsView : ReactiveUserControl +public partial class SettingsView : ReactiveUserControl { public SettingsView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs index a06753974..27f8c0075 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/AboutTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class AboutTabView : ReactiveUserControl +public partial class AboutTabView : ReactiveUserControl { public AboutTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs index a1d270474..a5031d9f6 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/DevicesTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class DevicesTabView : ReactiveUserControl +public partial class DevicesTabView : ReactiveUserControl { public DevicesTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs index 00ce4e09f..4b1c2b693 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/GeneralTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class GeneralTabView : ReactiveUserControl +public partial class GeneralTabView : ReactiveUserControl { public GeneralTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs index 1ac622fc7..b5428a68a 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class PluginsTabView : ReactiveUserControl +public partial class PluginsTabView : ReactiveUserControl { public PluginsTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs index b45ea27cb..d55406113 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/PluginsTabViewModel.cs @@ -12,6 +12,7 @@ using Artemis.UI.Screens.Plugins; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; +using Avalonia.ReactiveUI; using Avalonia.Threading; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs index 3421db5a7..7d0304e75 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings; -public class ReleasesTabView : ReactiveUserControl +public partial class ReleasesTabView : ReactiveUserControl { public ReleasesTabView() { diff --git a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs index de7f7cdd5..4e8baa0d2 100644 --- a/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs +++ b/src/Artemis.UI/Screens/Settings/Tabs/ReleasesTabViewModel.cs @@ -12,7 +12,7 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; using Artemis.WebClient.Updating; -using Avalonia.Threading; +using Avalonia.ReactiveUI; using DynamicData; using DynamicData.Binding; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs index 6bdcd52e7..d4670e37b 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Settings.Updating; -public class ReleaseView : ReactiveUserControl +public partial class ReleaseView : ReactiveUserControl { public ReleaseView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs b/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs index 815710dca..7d6977eb8 100644 --- a/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs +++ b/src/Artemis.UI/Screens/Sidebar/Behaviors/ProfileConfigurationDropHandler.cs @@ -12,10 +12,12 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase public override bool Validate(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { if (sender is ItemsControl itemsControl) - foreach (ItemContainerInfo? item in itemsControl.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(item.ContainerControl, false, false); + { + foreach (Control container in itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(container, false, false); + } - if (e.Source is IControl && sender is ListBox listBox) + if (e.Source is Control && sender is ListBox listBox) return Validate(listBox, e, sourceContext, targetContext, false); return false; @@ -24,10 +26,12 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase public override bool Execute(object? sender, DragEventArgs e, object? sourceContext, object? targetContext, object? state) { if (sender is ItemsControl itemsControl) - foreach (ItemContainerInfo? item in itemsControl.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(item.ContainerControl, false, false); + { + foreach (Control container in itemsControl.GetRealizedContainers()) + SetDraggingPseudoClasses(container, false, false); + } - if (e.Source is IControl && sender is ListBox listBox) + if (e.Source is Control && sender is ListBox listBox) return Validate(listBox, e, sourceContext, targetContext, true); return false; @@ -36,7 +40,7 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase private bool Validate(ListBox listBox, DragEventArgs e, object? sourceContext, object? targetContext, bool bExecute) { if (sourceContext is not SidebarProfileConfigurationViewModel sourceItem || targetContext is not SidebarCategoryViewModel vm || - listBox.GetVisualAt(e.GetPosition(listBox)) is not IControl targetControl) + listBox.GetVisualAt(e.GetPosition(listBox)) is not Control targetControl) return false; if (e.DragEffects != DragDropEffects.Move) return false; @@ -55,9 +59,9 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase before = false; } } - - foreach (ItemContainerInfo? item in listBox.ItemContainerGenerator.Containers) - SetDraggingPseudoClasses(item.ContainerControl, false, false); + + foreach (Control container in listBox.GetRealizedContainers()) + SetDraggingPseudoClasses(container, false, false); if (bExecute) { @@ -81,8 +85,11 @@ public class SidebarCategoryViewDropHandler : DropHandlerBase return true; } - private void SetDraggingPseudoClasses(IControl control, bool dragging, bool before) + private void SetDraggingPseudoClasses(Control? control, bool dragging, bool before) { + if (control == null) + return; + if (!dragging) { ((IPseudoClasses) control.Classes).Remove(":dragging"); diff --git a/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs index d43ccf664..d29132e7e 100644 --- a/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/ContentDialogs/SidebarCategoryEditView.axaml.cs @@ -5,7 +5,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class SidebarCategoryEditView : ReactiveUserControl +public partial class SidebarCategoryEditView : ReactiveUserControl { public SidebarCategoryEditView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs index 248296f5d..6e404be76 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class ModuleActivationRequirementView : ReactiveUserControl +public partial class ModuleActivationRequirementView : ReactiveUserControl { public ModuleActivationRequirementView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs index 8ddca2456..7467d8ba9 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ModuleActivationRequirementsView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Sidebar; -public class ModuleActivationRequirementsView : UserControl +public partial class ModuleActivationRequirementsView : UserControl { public ModuleActivationRequirementsView() { diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml index a127cdc14..bbf4b964b 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs index 14d01bd26..0b134ddc5 100644 --- a/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/Dialogs/ProfileConfigurationEditView.axaml.cs @@ -8,12 +8,12 @@ using ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class ProfileConfigurationEditView : ReactiveAppWindow +public partial class ProfileConfigurationEditView : ReactiveAppWindow { public ProfileConfigurationEditView() { InitializeComponent(); - this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.SelectedBitmapSource).Subscribe(_ => this.Get("FillPreview").InvalidateVisual()).DisposeWith(d)); + this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.SelectedBitmapSource).Subscribe(_ => FillPreview.InvalidateVisual()).DisposeWith(d)); #if DEBUG this.AttachDevTools(); diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml index e347ebd32..fb725cfb1 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml +++ b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml @@ -5,7 +5,6 @@ xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:local="clr-namespace:Artemis.UI.Screens.Sidebar" xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity" - xmlns:idd="clr-namespace:Avalonia.Xaml.Interactions.DragAndDrop;assembly=Avalonia.Xaml.Interactions" xmlns:sb="clr-namespace:Artemis.UI.Screens.Sidebar.Behaviors" xmlns:converters="clr-namespace:Artemis.UI.Converters" xmlns:b="clr-namespace:Artemis.UI.Behaviors" @@ -93,7 +92,7 @@ - + diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs index 6feeff883..1097b2567 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarCategoryView.axaml.cs @@ -14,21 +14,18 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.Sidebar; -public class SidebarCategoryView : ReactiveUserControl +public partial class SidebarCategoryView : ReactiveUserControl { private static Image? _dragAdorner; private Point _dragStartPosition; private Point _elementDragOffset; - private ListBox _listBox; public SidebarCategoryView() { InitializeComponent(); - _listBox = this.Get("SidebarListBox"); - AddHandler(DragDrop.DragEnterEvent, HandleDragEnterEvent, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); AddHandler(DragDrop.DragOverEvent, HandleDragOver, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - AddHandler(PointerEnterEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + AddHandler(PointerEnteredEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); } private void InitializeComponent() diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs index 005773daf..9222e5a5c 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarProfileConfigurationView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class SidebarProfileConfigurationView : ReactiveUserControl +public partial class SidebarProfileConfigurationView : ReactiveUserControl { public SidebarProfileConfigurationView() { diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs index 48106762a..ecfe9ddcc 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarScreenView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.Sidebar; -public class SidebarScreenView : UserControl +public partial class SidebarScreenView : UserControl { public SidebarScreenView() { diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs index a505680dd..4d3bff167 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Sidebar; -public class SidebarView : ReactiveUserControl +public partial class SidebarView : ReactiveUserControl { public SidebarView() { diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs index 7e1756384..ca13abff0 100644 --- a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs +++ b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs @@ -17,7 +17,7 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; using Artemis.UI.Shared.Services.ProfileEditor; -using Avalonia.Threading; +using Avalonia.ReactiveUI; using DryIoc; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs index 6e74c706e..a4f4e9c04 100644 --- a/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/StartupWizardView.axaml.cs @@ -11,10 +11,8 @@ using ReactiveUI; namespace Artemis.UI.Screens.StartupWizard; -public class StartupWizardView : ReactiveAppWindow +public partial class StartupWizardView : ReactiveAppWindow { - private readonly Frame _frame; - public StartupWizardView() { InitializeComponent(); @@ -22,8 +20,6 @@ public class StartupWizardView : ReactiveAppWindow this.AttachDevTools(); #endif - _frame = this.Get("Frame"); - this.WhenActivated(d => ViewModel.WhenAnyValue(vm => vm.CurrentStep).Subscribe(ApplyCurrentStep).DisposeWith(d)); } @@ -35,14 +31,14 @@ public class StartupWizardView : ReactiveAppWindow private void ApplyCurrentStep(int step) { if (step == 1) - _frame.NavigateToType(typeof(WelcomeStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(WelcomeStep), null, new FrameNavigationOptions()); else if (step == 2) - _frame.NavigateToType(typeof(DevicesStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(DevicesStep), null, new FrameNavigationOptions()); else if (step == 3) - _frame.NavigateToType(typeof(LayoutStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(LayoutStep), null, new FrameNavigationOptions()); else if (step == 4) - _frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions()); else if (step == 5) - _frame.NavigateToType(typeof(FinishStep), null, new FrameNavigationOptions()); + Frame.NavigateToType(typeof(FinishStep), null, new FrameNavigationOptions()); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs index b043d8950..d385e9452 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/DevicesStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class DevicesStep : UserControl +public partial class DevicesStep : UserControl { public DevicesStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs index 0c6b6555b..aed3014f1 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/FinishStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class FinishStep : UserControl +public partial class FinishStep : UserControl { public FinishStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs index a91f5e6db..dae2f4bec 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/LayoutStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class LayoutStep : UserControl +public partial class LayoutStep : UserControl { public LayoutStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs index ebd3f5855..343b11526 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/SettingsStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class SettingsStep : UserControl +public partial class SettingsStep : UserControl { public SettingsStep() { diff --git a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs index 1c75395cb..8a2ed216c 100644 --- a/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs +++ b/src/Artemis.UI/Screens/StartupWizard/Steps/WelcomeStep.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.StartupWizard.Steps; -public class WelcomeStep : UserControl +public partial class WelcomeStep : UserControl { public WelcomeStep() { diff --git a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs index 8d06e454c..878e3ad91 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/ListDeviceView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.SurfaceEditor; -public class ListDeviceView : UserControl +public partial class ListDeviceView : UserControl { public ListDeviceView() { diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs index 1de325892..ec1653427 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs @@ -7,7 +7,7 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.SurfaceEditor; -public class SurfaceDeviceView : ReactiveUserControl +public partial class SurfaceDeviceView : ReactiveUserControl { private bool _dragging; diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs index e7f12f075..5f46c2860 100644 --- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs +++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml.cs @@ -13,29 +13,18 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.SurfaceEditor; -public class SurfaceEditorView : ReactiveUserControl +public partial class SurfaceEditorView : ReactiveUserControl { - private readonly ItemsControl _deviceContainer; - private readonly SelectionRectangle _selectionRectangle; - private readonly Border _surfaceBounds; - private readonly ZoomBorder _zoomBorder; - public SurfaceEditorView() { InitializeComponent(); - - _zoomBorder = this.Find("ZoomBorder"); - _deviceContainer = this.Find("DeviceContainer"); - _selectionRectangle = this.Find("SelectionRectangle"); - _surfaceBounds = this.Find("SurfaceBounds"); - - _zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; UpdateZoomBorderBackground(); } private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property.Name == nameof(_zoomBorder.Background)) + if (e.Property.Name == nameof(ZoomBorder.Background)) UpdateZoomBorderBackground(); } @@ -47,25 +36,25 @@ public class SurfaceEditorView : ReactiveUserControl private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e) { UpdateZoomBorderBackground(); - _surfaceBounds.BorderThickness = new Thickness(2 / _zoomBorder.ZoomX); + SurfaceBounds.BorderThickness = new Thickness(2 / ZoomBorder.ZoomX); } private void SelectionRectangle_OnSelectionUpdated(object? sender, SelectionRectangleEventArgs e) { - List itemContainerInfos = _deviceContainer.ItemContainerGenerator.Containers.Where(c => c.ContainerControl.Bounds.Intersects(e.Rectangle)).ToList(); - List viewModels = itemContainerInfos.Where(c => c.Item is SurfaceDeviceViewModel).Select(c => (SurfaceDeviceViewModel) c.Item).ToList(); + List containers = DeviceContainer.GetRealizedContainers().Where(c => c.Bounds.Intersects(e.Rectangle)).ToList(); + List viewModels = containers.Where(c => c.DataContext is SurfaceDeviceViewModel).Select(c => (SurfaceDeviceViewModel) c.DataContext!).ToList(); ViewModel?.UpdateSelection(viewModels, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } private void ZoomBorder_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (!_selectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) + if (!SelectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) ViewModel?.ClearSelection(); } private void UpdateZoomBorderBackground() { - if (_zoomBorder.Background is VisualBrush visualBrush) - visualBrush.DestinationRect = new RelativeRect(_zoomBorder.OffsetX * -1, _zoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); + if (ZoomBorder.Background is VisualBrush visualBrush) + visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml index e18230f6f..30a6a4af5 100644 --- a/src/Artemis.UI/Screens/VisualScripting/CableView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/CableView.axaml @@ -18,8 +18,8 @@ - + +public partial class CableView : ReactiveUserControl { private const double CABLE_OFFSET = 24 * 4; - private readonly Path _cablePath; - private readonly Border _valueBorder; public CableView() { InitializeComponent(); - _cablePath = this.Get("CablePath"); - _valueBorder = this.Get("ValueBorder"); // Not using bindings here to avoid a warnings this.WhenActivated(d => { - _valueBorder.GetObservable(BoundsProperty).Subscribe(rect => _valueBorder.RenderTransform = new TranslateTransform(rect.Width / 2 * -1, rect.Height / 2 * -1)).DisposeWith(d); + ValueBorder.GetObservable(BoundsProperty).Subscribe(rect => ValueBorder.RenderTransform = new TranslateTransform(rect.Width / 2 * -1, rect.Height / 2 * -1)).DisposeWith(d); ViewModel.WhenAnyValue(vm => vm.FromPoint).Subscribe(_ => Update(true)).DisposeWith(d); ViewModel.WhenAnyValue(vm => vm.ToPoint).Subscribe(_ => Update(false)).DisposeWith(d); @@ -43,21 +40,21 @@ public class CableView : ReactiveUserControl private void Update(bool from) { // Workaround for https://github.com/AvaloniaUI/Avalonia/issues/4748 - _cablePath.Margin = new Thickness(_cablePath.Margin.Left + 1, _cablePath.Margin.Top + 1, 0, 0); - if (_cablePath.Margin.Left > 2) - _cablePath.Margin = new Thickness(0, 0, 0, 0); + CablePath.Margin = new Thickness(CablePath.Margin.Left + 1, CablePath.Margin.Top + 1, 0, 0); + if (CablePath.Margin.Left > 2) + CablePath.Margin = new Thickness(0, 0, 0, 0); - PathFigure pathFigure = ((PathGeometry) _cablePath.Data).Figures.First(); + PathFigure pathFigure = ((PathGeometry) CablePath.Data).Figures.First(); BezierSegment segment = (BezierSegment) pathFigure.Segments!.First(); pathFigure.StartPoint = ViewModel!.FromPoint; segment.Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y); segment.Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y); segment.Point3 = new Point(ViewModel.ToPoint.X, ViewModel.ToPoint.Y); - Canvas.SetLeft(_valueBorder, ViewModel.FromPoint.X + (ViewModel.ToPoint.X - ViewModel.FromPoint.X) / 2); - Canvas.SetTop(_valueBorder, ViewModel.FromPoint.Y + (ViewModel.ToPoint.Y - ViewModel.FromPoint.Y) / 2); + Canvas.SetLeft(ValueBorder, ViewModel.FromPoint.X + (ViewModel.ToPoint.X - ViewModel.FromPoint.X) / 2); + Canvas.SetTop(ValueBorder, ViewModel.FromPoint.Y + (ViewModel.ToPoint.Y - ViewModel.FromPoint.Y) / 2); - _cablePath.InvalidateVisual(); + CablePath.InvalidateVisual(); } private void OnPointerEnter(object? sender, PointerEventArgs e) diff --git a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs index 243576bb9..50bf07f77 100644 --- a/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/DragCableView.axaml.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Reactive.Disposables; using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Mixins; @@ -11,15 +12,13 @@ using ReactiveUI; namespace Artemis.UI.Screens.VisualScripting; -public class DragCableView : ReactiveUserControl +public partial class DragCableView : ReactiveUserControl { private const double CABLE_OFFSET = 24 * 4; - private readonly Path _cablePath; public DragCableView() { InitializeComponent(); - _cablePath = this.Get("CablePath"); // Not using bindings here to avoid warnings this.WhenActivated(d => @@ -37,8 +36,11 @@ public class DragCableView : ReactiveUserControl private void Update() { - PathFigure pathFigure = ((PathGeometry) _cablePath.Data).Figures.First(); - BezierSegment segment = (BezierSegment) pathFigure.Segments!.First(); + PathFigure? pathFigure = ((PathGeometry) CablePath.Data).Figures?.FirstOrDefault(); + if (pathFigure?.Segments == null) + return; + + BezierSegment segment = (BezierSegment) pathFigure.Segments.First(); pathFigure.StartPoint = ViewModel!.FromPoint; segment.Point1 = new Point(ViewModel.FromPoint.X + CABLE_OFFSET, ViewModel.FromPoint.Y); segment.Point2 = new Point(ViewModel.ToPoint.X - CABLE_OFFSET, ViewModel.ToPoint.Y); diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml index ce5f36c37..73065876d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml @@ -17,15 +17,15 @@ diff --git a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs index 82dd2cbb4..7e58be954 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodePickerView.axaml.cs @@ -1,4 +1,5 @@ using System; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Avalonia; @@ -13,7 +14,7 @@ using ReactiveUI; namespace Artemis.UI.Screens.VisualScripting; -public class NodePickerView : ReactiveUserControl +public partial class NodePickerView : ReactiveUserControl { public NodePickerView() { @@ -21,7 +22,7 @@ public class NodePickerView : ReactiveUserControl this.WhenActivated(d => { ViewModel?.WhenAnyValue(vm => vm.IsVisible).Where(visible => visible == false).Subscribe(_ => this.FindLogicalAncestorOfType()?.ContextFlyout?.Hide()).DisposeWith(d); - this.Get("SearchBox").SelectAll(); + SearchBox.SelectAll(); }); } diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs index 787f3fdca..1a395b871 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptView.axaml.cs @@ -19,28 +19,19 @@ using ReactiveUI; namespace Artemis.UI.Screens.VisualScripting; -public class NodeScriptView : ReactiveUserControl +public partial class NodeScriptView : ReactiveUserControl { - private readonly Grid _grid; - private readonly ItemsControl _nodesContainer; - private readonly SelectionRectangle _selectionRectangle; - private readonly ZoomBorder _zoomBorder; - public NodeScriptView() { InitializeComponent(); - _grid = this.Find("ContainerGrid"); - _zoomBorder = this.Find("ZoomBorder"); - _nodesContainer = this.Find("NodesContainer"); - _selectionRectangle = this.Find("SelectionRectangle"); - _zoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; + ZoomBorder.PropertyChanged += ZoomBorderOnPropertyChanged; UpdateZoomBorderBackground(); - _zoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - _zoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - _zoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); - + ZoomBorder.AddHandler(PointerReleasedEvent, CanvasOnPointerReleased, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + ZoomBorder.AddHandler(PointerWheelChangedEvent, ZoomOnPointerWheelChanged, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + ZoomBorder.AddHandler(PointerMovedEvent, ZoomOnPointerMoved, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true); + this.WhenActivated(d => { ViewModel!.AutoFitRequested += ViewModelOnAutoFitRequested; @@ -65,22 +56,22 @@ public class NodeScriptView : ReactiveUserControl private void ZoomOnPointerWheelChanged(object? sender, PointerWheelEventArgs e) { // If scroll events aren't handled here the ZoomBorder does some random panning when at the zoom limit - if (e.Delta.Y > 0 && _zoomBorder.ZoomX >= 1) + if (e.Delta.Y > 0 && ZoomBorder.ZoomX >= 1) e.Handled = true; } private void ZoomOnPointerMoved(object? sender, PointerEventArgs e) { if (ViewModel != null) - ViewModel.PastePosition = e.GetPosition(_grid); + ViewModel.PastePosition = e.GetPosition(ContainerGrid); } - + private void ShowPickerAt(Point point) { if (ViewModel == null) return; ViewModel.NodePickerViewModel.Position = point; - _zoomBorder?.ContextFlyout?.ShowAt(_zoomBorder, true); + ZoomBorder?.ContextFlyout?.ShowAt(ZoomBorder); } private void AutoFitIfPreview() @@ -91,7 +82,7 @@ public class NodeScriptView : ReactiveUserControl private void BoundsPropertyChanged(AvaloniaPropertyChangedEventArgs obj) { - if (_nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl).Contains(obj.Sender)) + if (NodesContainer.GetRealizedContainers().Contains(obj.Sender)) AutoFitIfPreview(); } @@ -99,18 +90,19 @@ public class NodeScriptView : ReactiveUserControl { // If the flyout handled the click, update the position of the node picker if (e.Handled && ViewModel != null) - ViewModel.NodePickerViewModel.Position = e.GetPosition(_grid); + ViewModel.NodePickerViewModel.Position = e.GetPosition(ContainerGrid); } private void AutoFit(bool skipTransitions) { - if (!_nodesContainer.ItemContainerGenerator.Containers.Any()) + List containers = NodesContainer.GetRealizedContainers().ToList(); + if (!containers.Any()) return; - double left = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Left).Min(); - double top = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Top).Min(); - double bottom = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Bottom).Max(); - double right = _nodesContainer.ItemContainerGenerator.Containers.Select(c => c.ContainerControl.Bounds.Right).Max(); + double left = containers.Select(c => c.Bounds.Left).Min(); + double top = containers.Select(c => c.Bounds.Top).Min(); + double bottom = containers.Select(c => c.Bounds.Bottom).Max(); + double right = containers.Select(c => c.Bounds.Right).Max(); // Add a 10 pixel margin around the rect Rect scriptRect = new(new Point(left - 10, top - 10), new Point(right + 10, bottom + 10)); @@ -119,8 +111,8 @@ public class NodeScriptView : ReactiveUserControl double scale = Math.Min(1, Math.Min(Bounds.Width / scriptRect.Width, Bounds.Height / scriptRect.Height)); // Pan and zoom to make the script fit - _zoomBorder.Zoom(scale, 0, 0, skipTransitions); - _zoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); + ZoomBorder.Zoom(scale, 0, 0, skipTransitions); + ZoomBorder.Pan(Bounds.Center.X - scriptRect.Center.X * scale, Bounds.Center.Y - scriptRect.Center.Y * scale, skipTransitions); } private void ViewModelOnAutoFitRequested(object? sender, EventArgs e) @@ -130,14 +122,14 @@ public class NodeScriptView : ReactiveUserControl private void ZoomBorderOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) { - if (e.Property.Name == nameof(_zoomBorder.Background)) + if (e.Property.Name == nameof(ZoomBorder.Background)) UpdateZoomBorderBackground(); } private void UpdateZoomBorderBackground() { - if (_zoomBorder.Background is VisualBrush visualBrush) - visualBrush.DestinationRect = new RelativeRect(_zoomBorder.OffsetX * -1, _zoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); + if (ZoomBorder.Background is VisualBrush visualBrush) + visualBrush.DestinationRect = new RelativeRect(ZoomBorder.OffsetX * -1, ZoomBorder.OffsetY * -1, 20, 20, RelativeUnit.Absolute); } private void InitializeComponent() @@ -148,14 +140,14 @@ public class NodeScriptView : ReactiveUserControl private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e) { if (ViewModel != null) - ViewModel.PanMatrix = _zoomBorder.Matrix; + ViewModel.PanMatrix = ZoomBorder.Matrix; UpdateZoomBorderBackground(); } private void SelectionRectangle_OnSelectionUpdated(object? sender, SelectionRectangleEventArgs e) { - List itemContainerInfos = _nodesContainer.ItemContainerGenerator.Containers.Where(c => c.ContainerControl.Bounds.Intersects(e.Rectangle)).ToList(); - List nodes = itemContainerInfos.Where(c => c.Item is NodeViewModel).Select(c => (NodeViewModel) c.Item).ToList(); + List itemContainerInfos = NodesContainer.GetRealizedContainers().Where(c => c.Bounds.Intersects(e.Rectangle)).ToList(); + List nodes = itemContainerInfos.Where(c => c.DataContext is NodeViewModel).Select(c => (NodeViewModel) c.DataContext!).ToList(); ViewModel?.UpdateNodeSelection(nodes, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control)); } @@ -166,7 +158,7 @@ public class NodeScriptView : ReactiveUserControl private void ZoomBorder_OnPointerReleased(object? sender, PointerReleasedEventArgs e) { - if (!_selectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) + if (!SelectionRectangle.IsSelecting && e.InitialPressMouseButton == MouseButton.Left) ViewModel?.ClearNodeSelection(); } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs index 5628da274..c7d2a8815 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptViewModel.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Text; @@ -17,7 +18,6 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Input; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml index aa862508f..b55439e50 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml @@ -1,4 +1,4 @@ - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs index 43e3736d0..a5ad7196d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeScriptWindowView.axaml.cs @@ -4,7 +4,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.VisualScripting; -public class NodeScriptWindowView : ReactiveAppWindow +public partial class NodeScriptWindowView : ReactiveAppWindow { public NodeScriptWindowView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs index 66f1804f3..8d0ba79e3 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeView.axaml.cs @@ -9,7 +9,7 @@ using Avalonia.VisualTree; namespace Artemis.UI.Screens.VisualScripting; -public class NodeView : ReactiveUserControl +public partial class NodeView : ReactiveUserControl { private bool _dragging; diff --git a/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs index 17b73778e..a033a271f 100644 --- a/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/NodeViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; @@ -12,7 +13,6 @@ using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Layout; using DynamicData; using DynamicData.Binding; diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs index 3f5afccb6..f7f3359c2 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinCollectionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class InputPinCollectionView : ReactiveUserControl +public partial class InputPinCollectionView : ReactiveUserControl { public InputPinCollectionView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs index b8cd39f09..8b5f106b0 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/InputPinView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class InputPinView : PinView +public partial class InputPinView : PinView { public InputPinView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs index b3411fe31..bb9a4a73d 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinCollectionView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class OutputPinCollectionView : ReactiveUserControl +public partial class OutputPinCollectionView : ReactiveUserControl { public OutputPinCollectionView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs index 3f721ddd9..a05817005 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/OutputPinView.axaml.cs @@ -5,7 +5,7 @@ using Avalonia.Markup.Xaml; namespace Artemis.UI.Screens.VisualScripting.Pins; -public class OutputPinView : PinView +public partial class OutputPinView : PinView { public OutputPinView() { diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs index d6e160dc4..a956380e1 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/PinCollectionViewModel.cs @@ -2,13 +2,13 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; using Artemis.UI.Shared; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; -using Avalonia.Controls.Mixins; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs b/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs index 37542daca..5a29c6301 100644 --- a/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs +++ b/src/Artemis.UI/Screens/VisualScripting/Pins/PinViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using System.Reactive; +using System.Reactive.Disposables; using System.Reactive.Linq; using Artemis.Core; using Artemis.Core.Events; @@ -10,7 +11,6 @@ using Artemis.UI.Shared.Extensions; using Artemis.UI.Shared.Services.NodeEditor; using Artemis.UI.Shared.Services.NodeEditor.Commands; using Avalonia; -using Avalonia.Controls.Mixins; using Avalonia.Media; using DynamicData; using ReactiveUI; diff --git a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs index c60987a56..7f8fac500 100644 --- a/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs +++ b/src/Artemis.UI/Screens/Workshop/WorkshopView.axaml.cs @@ -3,7 +3,7 @@ using Avalonia.ReactiveUI; namespace Artemis.UI.Screens.Workshop; -public class WorkshopView : ReactiveUserControl +public partial class WorkshopView : ReactiveUserControl { public WorkshopView() {