diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml
index 044774480..1f83763b9 100644
--- a/.github/workflows/docfx.yml
+++ b/.github/workflows/docfx.yml
@@ -18,13 +18,13 @@ jobs:
with:
dotnet-version: "7.0.x"
- name: Setup DocFX
- run: choco install docfx -y
+ run: dotnet tool update -g docfx
- name: Build Core
run: dotnet build src/Artemis.Core/Artemis.Core.csproj
- name: Build UI.Shared
run: dotnet build src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
- name: Build DocFX
- run: docfx.exe docfx/docfx_project/docfx.json
+ run: docfx docfx/docfx_project/docfx.json
- name: Upload to FTP
uses: SamKirkland/FTP-Deploy-Action@4.3.2
with:
diff --git a/docfx/docfx_project/docfx.json b/docfx/docfx_project/docfx.json
index 525c27ace..003caa407 100644
--- a/docfx/docfx_project/docfx.json
+++ b/docfx/docfx_project/docfx.json
@@ -5,7 +5,7 @@
{
"files": [
"Artemis.Core/bin/net7.0/Artemis.Core.dll",
- "Artemis.UI.Shared/bin/net7.0/Artemis.UI.Shared.dll",
+ "Artemis.UI.Shared/bin/net7.0/Artemis.UI.Shared.dll"
],
"src": "../../src"
}
diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj
index ed6e16421..33d2a5382 100644
--- a/src/Artemis.Core/Artemis.Core.csproj
+++ b/src/Artemis.Core/Artemis.Core.csproj
@@ -43,9 +43,9 @@
-
-
-
+
+
+
diff --git a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj
index 9607a10d8..21c5abd88 100644
--- a/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj
+++ b/src/Artemis.UI.Linux/Artemis.UI.Linux.csproj
@@ -16,11 +16,11 @@
-
-
+
+
-
-
+
+
diff --git a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj
index e674a2ad6..9e2fc0938 100644
--- a/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj
+++ b/src/Artemis.UI.MacOS/Artemis.UI.MacOS.csproj
@@ -15,11 +15,11 @@
-
-
+
+
-
-
+
+
diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
index 0c4439627..3b69f3087 100644
--- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
+++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj
@@ -10,17 +10,17 @@
-
+
-
-
-
+
+
+
-
-
+
+
-
+
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
index eca232ba4..80c72b0a5 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
@@ -1,9 +1,10 @@
-using System;
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using Artemis.Core;
+using Artemis.Core.Services;
using Artemis.UI.Shared.Events;
using Avalonia;
using Avalonia.Controls;
@@ -13,6 +14,7 @@ using Avalonia.Media;
using Avalonia.Media.Imaging;
using Avalonia.Threading;
using RGB.NET.Core;
+using DryIoc;
using Color = RGB.NET.Core.Color;
using Point = Avalonia.Point;
using Size = Avalonia.Size;
@@ -24,20 +26,19 @@ namespace Artemis.UI.Shared;
///
public class DeviceVisualizer : Control
{
- private const double UPDATE_FRAME_RATE = 25.0;
+ private readonly ICoreService _coreService;
private readonly List _deviceVisualizerLeds;
- private readonly DispatcherTimer _timer;
private Rect _deviceBounds;
private RenderTargetBitmap? _deviceImage;
private ArtemisDevice? _oldDevice;
private bool _loading;
private Color[] _previousState = Array.Empty();
-
+
///
public DeviceVisualizer()
{
- _timer = new DispatcherTimer(DispatcherPriority.Background) {Interval = TimeSpan.FromMilliseconds(1000.0 / UPDATE_FRAME_RATE)};
+ _coreService = UI.Locator.Resolve();
_deviceVisualizerLeds = new List();
PointerReleased += OnPointerReleased;
@@ -120,23 +121,26 @@ public class DeviceVisualizer : Control
if (Device == null)
return false;
- Color[] state = new Color[Device.RgbDevice.Count()];
- bool difference = _previousState.Length != state.Length;
+ bool difference = false;
+
+ int newLedCount = Device.RgbDevice.Count();
+ if (_previousState.Length != newLedCount)
+ {
+ _previousState = new Color[newLedCount];
+ difference = true;
+ }
// Check all LEDs for differences and copy the colors to a new state
int index = 0;
foreach (Led led in Device.RgbDevice)
{
- if (!difference && !led.Color.Equals(_previousState[index]))
+ if (_previousState[index] != led.Color)
difference = true;
- state[index] = led.Color;
+ _previousState[index] = led.Color;
index++;
}
- // Store the new state for next time
- _previousState = state;
-
return difference;
}
@@ -156,11 +160,14 @@ public class DeviceVisualizer : Control
return geometry.Bounds;
}
-
- private void TimerOnTick(object? sender, EventArgs e)
+
+ private void OnFrameRendered(object? sender, FrameRenderedEventArgs e)
{
- if (IsDirty() && ShowColors && IsVisible && Opacity > 0)
- Update();
+ Dispatcher.UIThread.Post(() =>
+ {
+ if (ShowColors && IsVisible && Opacity > 0 && IsDirty())
+ Update();
+ }, DispatcherPriority.Background);
}
private void OnPointerReleased(object? sender, PointerReleasedEventArgs e)
@@ -250,16 +257,16 @@ public class DeviceVisualizer : Control
///
protected override void OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs e)
{
- _timer.Start();
- _timer.Tick += TimerOnTick;
+ _coreService.FrameRendered += OnFrameRendered;
+
base.OnAttachedToLogicalTree(e);
}
///
protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
{
- _timer.Stop();
- _timer.Tick -= TimerOnTick;
+ _coreService.FrameRendered -= OnFrameRendered;
+
base.OnDetachedFromLogicalTree(e);
}
diff --git a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml
index 0c571239e..5802bd188 100644
--- a/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml
+++ b/src/Artemis.UI.Shared/Controls/DraggableNumberBox.axaml
@@ -6,25 +6,27 @@
xmlns:sharedControls="clr-namespace:Artemis.UI.Shared.Controls"
xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
- x:Class="Artemis.UI.Shared.Controls.DraggableNumberBox">
+ x:Class="Artemis.UI.Shared.Controls.DraggableNumberBox"
+ Focusable="True">
-
-
-
-
+
{
UpdateDisplayTextBox();
@@ -78,7 +79,19 @@ public partial class HotkeyBox : UserControl
private void InputServiceOnKeyboardKeyUp(object? sender, ArtemisKeyboardKeyEventArgs e)
{
if (e.Modifiers == KeyboardModifierKey.None)
- Dispatcher.UIThread.Post(() => FocusManager.Instance?.Focus(null));
+ Dispatcher.UIThread.Post(ClearFocus);
+ }
+
+ private void ClearFocus()
+ {
+ InputElement? element = this.FindAncestorOfType();
+ if (element == null)
+ return;
+
+ bool wasFocusable = element.Focusable;
+ element.Focusable = true;
+ element.Focus();
+ element.Focusable = wasFocusable;
}
private void UpdateDisplayTextBox()
@@ -96,7 +109,7 @@ public partial class HotkeyBox : UserControl
private void Button_OnClick(object? sender, RoutedEventArgs e)
{
Hotkey = null;
- FocusManager.Instance?.Focus(null);
+ ClearFocus();
UpdateDisplayTextBox();
}
diff --git a/src/Artemis.UI.Shared/ReactiveAppWindow.cs b/src/Artemis.UI.Shared/ReactiveAppWindow.cs
index 58f4ad820..a751f4ee6 100644
--- a/src/Artemis.UI.Shared/ReactiveAppWindow.cs
+++ b/src/Artemis.UI.Shared/ReactiveAppWindow.cs
@@ -48,7 +48,7 @@ public class ReactiveAppWindow : AppWindow, IViewFor whe
return;
TransparencyBackgroundFallback = Brushes.Transparent;
- TransparencyLevelHint = WindowTransparencyLevel.Mica;
+ TransparencyLevelHint = new[] {WindowTransparencyLevel.Mica};
TryEnableMicaEffect();
}
diff --git a/src/Artemis.UI.Shared/Styles/Border.axaml b/src/Artemis.UI.Shared/Styles/Border.axaml
index afcd9dee8..d753809a0 100644
--- a/src/Artemis.UI.Shared/Styles/Border.axaml
+++ b/src/Artemis.UI.Shared/Styles/Border.axaml
@@ -10,6 +10,15 @@
I'm in a panel yo!
I'm in a panel yo!
+
+ I'm in a panel yo!
+
+
+
+
+ I'm in a panel yo!
+
+ I'm in a panel yo!
@@ -50,4 +59,23 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI.Shared/Utilities.cs b/src/Artemis.UI.Shared/Utilities.cs
index cb2d58992..832e07b75 100644
--- a/src/Artemis.UI.Shared/Utilities.cs
+++ b/src/Artemis.UI.Shared/Utilities.cs
@@ -1,7 +1,5 @@
using System;
-using System.ComponentModel;
using System.Reactive.Linq;
-using System.Reactive.Subjects;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Input.Platform;
@@ -14,12 +12,9 @@ namespace Artemis.UI.Shared;
///
public static class UI
{
- private static readonly BehaviorSubject KeyBindingsEnabledSubject = new(false);
-
static UI()
{
- if (KeyboardDevice.Instance != null)
- KeyboardDevice.Instance.PropertyChanged += InstanceOnPropertyChanged;
+ KeyBindingsEnabled = InputElement.GotFocusEvent.Raised.Select(e => e.Item2.Source is not TextBox).StartWith(true);
}
///
@@ -35,15 +30,5 @@ public static class UI
///
/// Gets a boolean indicating whether hotkeys are to be disabled.
///
- public static IObservable KeyBindingsEnabled { get; } = KeyBindingsEnabledSubject.AsObservable();
-
- private static void InstanceOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
- {
- if (KeyboardDevice.Instance == null || e.PropertyName != nameof(KeyboardDevice.FocusedElement))
- return;
-
- bool enabled = KeyboardDevice.Instance.FocusedElement is not TextBox;
- if (KeyBindingsEnabledSubject.Value != enabled)
- KeyBindingsEnabledSubject.OnNext(enabled);
- }
+ public static IObservable KeyBindingsEnabled { get; }
}
\ No newline at end of file
diff --git a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj
index bdea0536c..0110ec37e 100644
--- a/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj
+++ b/src/Artemis.UI.Windows/Artemis.UI.Windows.csproj
@@ -1,4 +1,4 @@
-
+
WinExe
net7.0-windows10.0.17763.0
@@ -21,15 +21,15 @@
-
-
+
+
-
-
-
+
+
+
-
+
diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj
index f30f7879f..54e584d67 100644
--- a/src/Artemis.UI/Artemis.UI.csproj
+++ b/src/Artemis.UI/Artemis.UI.csproj
@@ -16,25 +16,25 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
+
+
@@ -42,27 +42,4 @@
-
-
-
- UpdatingTabView.axaml
- Code
-
-
- UpdatingTabView.axaml
- Code
-
-
- PluginFeatureView.axaml
- Code
-
-
- PluginPrerequisiteActionView.axaml
- Code
-
-
- PluginPrerequisiteView.axaml
- Code
-
-
\ No newline at end of file
diff --git a/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs b/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs
index bd3845bfa..b23346427 100644
--- a/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs
+++ b/src/Artemis.UI/Behaviors/SimpleContextDragBehavior.cs
@@ -103,8 +103,9 @@ public class SimpleContextDragBehavior : Behavior
private void AssociatedObject_PointerPressed(object? sender, PointerPressedEventArgs e)
{
+ IFocusManager? focusManager = TopLevel.GetTopLevel(AssociatedObject)?.FocusManager;
PointerPointProperties properties = e.GetCurrentPoint(AssociatedObject).Properties;
- if (!properties.IsLeftButtonPressed || FocusManager.Instance?.Current is TextBox)
+ if (!properties.IsLeftButtonPressed || focusManager?.GetFocusedElement() is TextBox)
return;
if (e.Source is not Control control || AssociatedObject?.DataContext != control.DataContext)
return;
@@ -130,8 +131,9 @@ public class SimpleContextDragBehavior : Behavior
private async void AssociatedObject_PointerMoved(object? sender, PointerEventArgs e)
{
+ IFocusManager? focusManager = TopLevel.GetTopLevel(AssociatedObject)?.FocusManager;
PointerPointProperties properties = e.GetCurrentPoint(AssociatedObject).Properties;
- if (!properties.IsLeftButtonPressed || FocusManager.Instance?.Current is TextBox)
+ if (!properties.IsLeftButtonPressed || focusManager?.GetFocusedElement() is TextBox)
return;
if (_triggerEvent is null)
diff --git a/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs b/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs
index 1ef4838a8..9063787d5 100644
--- a/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs
+++ b/src/Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml.cs
@@ -1,5 +1,4 @@
using Avalonia.Input;
-using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace Artemis.UI.DefaultTypes.PropertyInput;
@@ -16,6 +15,6 @@ public partial class StringPropertyInputView : ReactiveUserControl selectedLeds);
InputMappingsTabViewModel InputMappingsTabViewModel(ArtemisDevice device, ObservableCollection selectedLeds);
+ DeviceGeneralTabViewModel DeviceGeneralTabViewModel(ArtemisDevice device);
}
public class DeviceFactory : IDeviceVmFactory
{
@@ -68,16 +69,11 @@ public class DeviceFactory : IDeviceVmFactory
return _container.Resolve(new object[] { device });
}
- public DevicePropertiesTabViewModel DevicePropertiesTabViewModel(ArtemisDevice device)
+ public DeviceLayoutTabViewModel DeviceLayoutTabViewModel(ArtemisDevice device)
{
- return _container.Resolve(new object[] { device });
+ return _container.Resolve(new object[] { device });
}
-
- public DeviceInfoTabViewModel DeviceInfoTabViewModel(ArtemisDevice device)
- {
- return _container.Resolve(new object[] { device });
- }
-
+
public DeviceLedsTabViewModel DeviceLedsTabViewModel(ArtemisDevice device, ObservableCollection selectedLeds)
{
return _container.Resolve(new object[] { device, selectedLeds });
@@ -87,6 +83,11 @@ public class DeviceFactory : IDeviceVmFactory
{
return _container.Resolve(new object[] { device, selectedLeds });
}
+
+ public DeviceGeneralTabViewModel DeviceGeneralTabViewModel(ArtemisDevice device)
+ {
+ return _container.Resolve(new object[] { device });
+ }
}
public interface ISettingsVmFactory : IVmFactory
diff --git a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml
index af60e504b..c6b2108fc 100644
--- a/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml
+++ b/src/Artemis.UI/Screens/Debugger/Tabs/Performance/PerformanceDebugView.axaml
@@ -17,7 +17,7 @@
These performance stats are rather basic, for advanced performance profiling check out the wiki.
-
+
JetBrains Profiling Guide
diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml
index 22b63510e..2d0bccd94 100644
--- a/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml
+++ b/src/Artemis.UI/Screens/Device/DevicePropertiesView.axaml
@@ -1,58 +1,59 @@
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
+ xmlns:device="clr-namespace:Artemis.UI.Screens.Device"
+ xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
+ mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="800"
+ x:Class="Artemis.UI.Screens.Device.DevicePropertiesView"
+ x:DataType="device:DevicePropertiesViewModel"
+ Icon="/Assets/Images/Logo/application.ico"
+ Title="Artemis | Device Properties"
+ WindowStartupLocation="CenterOwner"
+ Width="1400"
+ Height="800">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
-
+
@@ -69,6 +70,6 @@
-
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Screens/Device/DevicePropertiesViewModel.cs b/src/Artemis.UI/Screens/Device/DevicePropertiesViewModel.cs
index 87ee3ae20..2c9cf056a 100644
--- a/src/Artemis.UI/Screens/Device/DevicePropertiesViewModel.cs
+++ b/src/Artemis.UI/Screens/Device/DevicePropertiesViewModel.cs
@@ -64,8 +64,8 @@ public class DevicePropertiesViewModel : DialogViewModelBase