1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Device dialog - Added LEDs tab

General - Resolved lots of compile warnings (XML comments)
This commit is contained in:
Robert 2022-06-19 14:19:03 +02:00
parent 021f17aef4
commit 65837e671a
44 changed files with 1015 additions and 761 deletions

View File

@ -19,6 +19,8 @@
<entry key="Artemis.UI.Shared/Controls/EnumComboBox.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI.Shared/Controls/EnumComboBox.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI.Shared/Controls/HotkeyBox.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI.Shared/Controls/HotkeyBox.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI.Shared/Controls/ProfileConfigurationIcon.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI.Shared/DefaultTypes/DataModel/Display/DefaultDataModelDisplayView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI.Shared/DefaultTypes/DataModel/Display/SKColorDataModelDisplayView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI.Shared/Styles/Border.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI.Shared/Styles/Border.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI.Shared/Styles/Condensed.axaml" value="Artemis.UI.Windows/Artemis.UI.Windows.csproj" /> <entry key="Artemis.UI.Shared/Styles/Condensed.axaml" value="Artemis.UI.Windows/Artemis.UI.Windows.csproj" />
<entry key="Artemis.UI.Shared/Styles/TextBlock.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI.Shared/Styles/TextBlock.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
@ -40,6 +42,7 @@
<entry key="Artemis.UI/Screens/Device/DevicePropertiesView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Device/DevicePropertiesView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Device/DeviceSettingsView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Device/DeviceSettingsView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Device/Tabs/DeviceInfoTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Device/Tabs/DeviceLedsTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Device/Tabs/DevicePropertiesTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Device/Tabs/InputMappingsTabView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Plugins/PluginFeatureView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Plugins/PluginFeatureView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />

View File

@ -153,7 +153,18 @@ namespace Artemis.Core.Services
/// <param name="color">The color to display</param> /// <param name="color">The color to display</param>
TypeColorRegistration RegisterTypeColor(Plugin plugin, Type type, SKColor color); TypeColorRegistration RegisterTypeColor(Plugin plugin, Type type, SKColor color);
/// <summary>
/// Exports the provided node script to JSON.
/// </summary>
/// <param name="nodeScript">The node script to export.</param>
/// <returns>The resulting JSON.</returns>
string ExportScript(NodeScript nodeScript); string ExportScript(NodeScript nodeScript);
/// <summary>
/// Imports the provided JSON onto the provided node script, overwriting any existing contents.
/// </summary>
/// <param name="json">The JSON to import.</param>
/// <param name="target">The target node script whose contents to overwrite.</param>
void ImportScript(string json, NodeScript target); void ImportScript(string json, NodeScript target);
} }
} }

View File

@ -6,19 +6,29 @@
<members> <members>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.ArtemisIcon.IconProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.ArtemisIcon.IconProperty">
<summary> <summary>
Gets or sets the currently displayed icon as either a <see cref="T:Material.Icons.MaterialIconKind" /> or an <see cref="T:System.Uri" /> pointing Gets or sets the currently displayed icon as either a
<see cref="T:Material.Icons.MaterialIconKind"/>
or an
<see cref="T:System.Uri"/>
pointing
to an SVG to an SVG
</summary> </summary>
</member> </member>
<member name="P:Artemis.UI.Avalonia.Shared.Controls.ArtemisIcon.Icon"> <member name="P:Artemis.UI.Avalonia.Shared.Controls.ArtemisIcon.Icon">
<summary> <summary>
Gets or sets the currently displayed icon as either a <see cref="T:Material.Icons.MaterialIconKind" /> or an <see cref="T:System.Uri" /> pointing Gets or sets the currently displayed icon as either a
<see cref="T:Material.Icons.MaterialIconKind"/>
or an
<see cref="T:System.Uri"/>
pointing
to an SVG to an SVG
</summary> </summary>
</member> </member>
<member name="T:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer"> <member name="T:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer">
<summary> <summary>
Visualizes an <see cref="T:Artemis.Core.ArtemisDevice" /> with optional per-LED colors Visualizes an
<see cref="T:Artemis.Core.ArtemisDevice"/>
with optional per-LED colors
</summary> </summary>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.#ctor"> <member name="M:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.#ctor">
@ -34,18 +44,24 @@
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.OnLedClicked(Artemis.UI.Avalonia.Shared.Events.LedClickedEventArgs)"> <member name="M:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.OnLedClicked(Artemis.UI.Avalonia.Shared.Events.LedClickedEventArgs)">
<summary> <summary>
Invokes the <see cref="E:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.LedClicked" /> event Invokes the
<see cref="E:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.LedClicked"/>
event
</summary> </summary>
<param name="e"></param> <param name="e"></param>
</member> </member>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.DeviceProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.DeviceProperty">
<summary> <summary>
Gets or sets the <see cref="T:Artemis.Core.ArtemisDevice" /> to display Gets or sets the
<see cref="T:Artemis.Core.ArtemisDevice"/>
to display
</summary> </summary>
</member> </member>
<member name="P:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.Device"> <member name="P:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.Device">
<summary> <summary>
Gets or sets the <see cref="T:Artemis.Core.ArtemisDevice" /> to display Gets or sets the
<see cref="T:Artemis.Core.ArtemisDevice"/>
to display
</summary> </summary>
</member> </member>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.ShowColorsProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.ShowColorsProperty">
@ -95,37 +111,51 @@
</member> </member>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.ProfileConfigurationIcon.ConfigurationIconProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.ProfileConfigurationIcon.ConfigurationIconProperty">
<summary> <summary>
Gets or sets the <see cref="T:Artemis.Core.ProfileConfigurationIcon" /> to display Gets or sets the
<see cref="T:Artemis.Core.ProfileConfigurationIcon"/>
to display
</summary> </summary>
</member> </member>
<member name="P:Artemis.UI.Avalonia.Shared.Controls.ProfileConfigurationIcon.ConfigurationIcon"> <member name="P:Artemis.UI.Avalonia.Shared.Controls.ProfileConfigurationIcon.ConfigurationIcon">
<summary> <summary>
Gets or sets the <see cref="T:Artemis.Core.ProfileConfigurationIcon" /> to display Gets or sets the
<see cref="T:Artemis.Core.ProfileConfigurationIcon"/>
to display
</summary> </summary>
</member> </member>
<member name="T:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle"> <member name="T:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle">
<summary> <summary>
Visualizes an <see cref="T:Artemis.Core.ArtemisDevice" /> with optional per-LED colors Visualizes an
<see cref="T:Artemis.Core.ArtemisDevice"/>
with optional per-LED colors
</summary> </summary>
</member> </member>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BackgroundProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BackgroundProperty">
<summary> <summary>
Defines the <see cref="P:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.Background" /> property. Defines the
<see cref="P:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.Background"/>
property.
</summary> </summary>
</member> </member>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderBrushProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderBrushProperty">
<summary> <summary>
Defines the <see cref="P:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderBrush" /> property. Defines the
<see cref="P:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderBrush"/>
property.
</summary> </summary>
</member> </member>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderThicknessProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderThicknessProperty">
<summary> <summary>
Defines the <see cref="P:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderBrush" /> property. Defines the
<see cref="P:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderBrush"/>
property.
</summary> </summary>
</member> </member>
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.InputElementProperty"> <member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.InputElementProperty">
<summary> <summary>
Defines the <see cref="M:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.get_InputElement" /> property. Defines the
<see cref="M:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.get_InputElement"/>
property.
</summary> </summary>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.#ctor"> <member name="M:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.#ctor">
@ -154,7 +184,9 @@
</member> </member>
<member name="T:Artemis.UI.Avalonia.Shared.Converters.ColorToSKColorConverter"> <member name="T:Artemis.UI.Avalonia.Shared.Converters.ColorToSKColorConverter">
<summary> <summary>
Converts <see cref="T:Avalonia.Media.Color" /> into <see cref="T:SkiaSharp.SKColor" />. Converts
<see cref="T:Avalonia.Media.Color"/>
into<see cref="T:SkiaSharp.SKColor"/>.
</summary> </summary>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Converters.ColorToSKColorConverter.Convert(System.Object,System.Type,System.Object,System.Globalization.CultureInfo)"> <member name="M:Artemis.UI.Avalonia.Shared.Converters.ColorToSKColorConverter.Convert(System.Object,System.Type,System.Object,System.Globalization.CultureInfo)">
@ -165,7 +197,9 @@
</member> </member>
<member name="T:Artemis.UI.Avalonia.Shared.Converters.SKColorToColorConverter"> <member name="T:Artemis.UI.Avalonia.Shared.Converters.SKColorToColorConverter">
<summary> <summary>
Converts <see cref="T:SkiaSharp.SKColor" /> into <see cref="T:Avalonia.Media.Color" />. Converts
<see cref="T:SkiaSharp.SKColor"/>
into<see cref="T:Avalonia.Media.Color"/>.
</summary> </summary>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Converters.SKColorToColorConverter.Convert(System.Object,System.Type,System.Object,System.Globalization.CultureInfo)"> <member name="M:Artemis.UI.Avalonia.Shared.Converters.SKColorToColorConverter.Convert(System.Object,System.Type,System.Object,System.Globalization.CultureInfo)">
@ -176,7 +210,8 @@
</member> </member>
<member name="T:Artemis.UI.Avalonia.Shared.Events.DataModelInputDynamicEventArgs"> <member name="T:Artemis.UI.Avalonia.Shared.Events.DataModelInputDynamicEventArgs">
<summary> <summary>
Provides data about selection events raised by <see cref="!:DataModelDynamicViewModel" /> Provides data about selection events raised by
<see cref="!:DataModelDynamicViewModel"/>
</summary> </summary>
</member> </member>
<member name="P:Artemis.UI.Avalonia.Shared.Events.DataModelInputDynamicEventArgs.DataModelPath"> <member name="P:Artemis.UI.Avalonia.Shared.Events.DataModelInputDynamicEventArgs.DataModelPath">
@ -186,7 +221,8 @@
</member> </member>
<member name="T:Artemis.UI.Avalonia.Shared.Events.DataModelInputStaticEventArgs"> <member name="T:Artemis.UI.Avalonia.Shared.Events.DataModelInputStaticEventArgs">
<summary> <summary>
Provides data about submit events raised by <see cref="!:DataModelStaticViewModel" /> Provides data about submit events raised by
<see cref="!:DataModelStaticViewModel"/>
</summary> </summary>
</member> </member>
<member name="P:Artemis.UI.Avalonia.Shared.Events.DataModelInputStaticEventArgs.Value"> <member name="P:Artemis.UI.Avalonia.Shared.Events.DataModelInputStaticEventArgs.Value">
@ -246,7 +282,9 @@
</member> </member>
<member name="T:Artemis.UI.Avalonia.Shared.Ninject.SharedUIModule"> <member name="T:Artemis.UI.Avalonia.Shared.Ninject.SharedUIModule">
<summary> <summary>
The main <see cref="T:Ninject.Modules.NinjectModule" /> of the Artemis Shared UI toolkit that binds all services The main
<see cref="T:Ninject.Modules.NinjectModule"/>
of the Artemis Shared UI toolkit that binds all services
</summary> </summary>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Ninject.SharedUIModule.Load"> <member name="M:Artemis.UI.Avalonia.Shared.Ninject.SharedUIModule.Load">
@ -273,7 +311,9 @@
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.PluginConfigurationViewModel.#ctor(Artemis.Core.Plugin)"> <member name="M:Artemis.UI.Avalonia.Shared.PluginConfigurationViewModel.#ctor(Artemis.Core.Plugin)">
<summary> <summary>
Creates a new instance of the <see cref="T:Artemis.UI.Avalonia.Shared.PluginConfigurationViewModel" /> class Creates a new instance of the
<see cref="T:Artemis.UI.Avalonia.Shared.PluginConfigurationViewModel"/>
class
</summary> </summary>
<param name="plugin"></param> <param name="plugin"></param>
</member> </member>
@ -397,7 +437,9 @@
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowWindow``1(System.ValueTuple{System.String,System.Object}[])"> <member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowWindow``1(System.ValueTuple{System.String,System.Object}[])">
<summary> <summary>
Creates a view model instance of type <typeparamref name="TViewModel" /> and shows its corresponding View as a window Creates a view model instance of type
<typeparamref name="TViewModel"/>
and shows its corresponding View as a window
</summary> </summary>
<typeparam name="TViewModel">The type of view model to create</typeparam> <typeparam name="TViewModel">The type of view model to create</typeparam>
<returns>The created view model</returns> <returns>The created view model</returns>
@ -421,15 +463,21 @@
</summary> </summary>
<typeparam name="TResult">The return type</typeparam> <typeparam name="TResult">The return type</typeparam>
<param name="viewModel">ViewModel to show the View for</param> <param name="viewModel">ViewModel to show the View for</param>
<returns>A task containing the return value of type <typeparamref name="TResult" /></returns> <returns>A task containing the return value of type
<typeparamref name="TResult"/>
</returns>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowDialogAsync``2(System.ValueTuple{System.String,System.Object}[])"> <member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowDialogAsync``2(System.ValueTuple{System.String,System.Object}[])">
<summary> <summary>
Creates a view model instance of type <typeparamref name="TViewModel"/> and shows its corresponding View as a Dialog Creates a view model instance of type
<typeparamref name="TViewModel"/>
and shows its corresponding View as a Dialog
</summary> </summary>
<typeparam name="TViewModel">The view model type</typeparam> <typeparam name="TViewModel">The view model type</typeparam>
<typeparam name="TResult">The return type</typeparam> <typeparam name="TResult">The return type</typeparam>
<returns>A task containing the return value of type <typeparamref name="TResult" /></returns> <returns>A task containing the return value of type
<typeparamref name="TResult"/>
</returns>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowConfirmContentDialog(System.String,System.String,System.String,System.String)"> <member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowConfirmContentDialog(System.String,System.String,System.String,System.String)">
<summary> <summary>
@ -438,8 +486,15 @@
<param name="title">The title of the dialog</param> <param name="title">The title of the dialog</param>
<param name="message">The message of the dialog</param> <param name="message">The message of the dialog</param>
<param name="confirm">The text of the confirm button</param> <param name="confirm">The text of the confirm button</param>
<param name="cancel">The text of the cancel button, if <see langword="null"/> the cancel button will not be shown</param> <param name="cancel">The text of the cancel button, if
<returns>A task containing the result of the dialog, <see langword="true"/> if confirmed; otherwise <see langword="false"/></returns> <see langword="null"/>
the cancel button will not be shown
</param>
<returns>A task containing the result of the dialog,
<see langword="true"/>
if confirmed; otherwise
<see langword="false"/>
</returns>
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.CreateOpenFileDialog"> <member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.CreateOpenFileDialog">
<summary> <summary>
@ -476,8 +531,10 @@
Releases the unmanaged resources used by the object and optionally releases the managed resources. Releases the unmanaged resources used by the object and optionally releases the managed resources.
</summary> </summary>
<param name="disposing"> <param name="disposing">
<see langword="true" /> to release both managed and unmanaged resources; <see langword="true"/>
<see langword="false" /> to release only unmanaged resources. to release both managed and unmanaged resources;
<see langword="false"/>
to release only unmanaged resources.
</param> </param>
</member> </member>
<member name="P:Artemis.UI.Avalonia.Shared.ActivatableViewModelBase.Activator"> <member name="P:Artemis.UI.Avalonia.Shared.ActivatableViewModelBase.Activator">
@ -493,7 +550,8 @@
</member> </member>
<member name="M:Artemis.UI.Avalonia.Shared.DialogViewModelBase`1.Close(`0)"> <member name="M:Artemis.UI.Avalonia.Shared.DialogViewModelBase`1.Close(`0)">
<summary> <summary>
Closes the dialog with the given <paramref name="result" /> Closes the dialog with the given
<paramref name="result"/>
</summary> </summary>
<param name="result">The result of the dialog</param> <param name="result">The result of the dialog</param>
</member> </member>

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Diagnostics;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Data; using Avalonia.Data;
@ -12,13 +11,72 @@ using FluentAvalonia.UI.Controls;
namespace Artemis.UI.Shared.Controls; namespace Artemis.UI.Shared.Controls;
public partial class DraggableNumberBox : UserControl /// <summary>
/// Represents a number box that can be mutated by dragging over it horizontally
/// </summary>
public class DraggableNumberBox : UserControl
{ {
/// <summary> /// <summary>
/// Gets or sets the value of the number box. /// Defines the <see cref="Value" /> property.
/// </summary> /// </summary>
public static readonly StyledProperty<double> ValueProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Value), defaultBindingMode: BindingMode.TwoWay); public static readonly StyledProperty<double> ValueProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Value), defaultBindingMode: BindingMode.TwoWay);
/// <summary>
/// Defines the <see cref="Minimum" /> property.
/// </summary>
public static readonly StyledProperty<double> MinimumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Minimum), double.MinValue);
/// <summary>
/// Defines the <see cref="Maximum" /> property.
/// </summary>
public static readonly StyledProperty<double> MaximumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Maximum), double.MaxValue);
/// <summary>
/// Defines the <see cref="LargeChange" /> property.
/// </summary>
public static readonly StyledProperty<double> LargeChangeProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(LargeChange));
/// <summary>
/// Defines the <see cref="SmallChange" /> property.
/// </summary>
public static readonly StyledProperty<double> SmallChangeProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(SmallChange));
/// <summary>
/// Defines the <see cref="SimpleNumberFormat" /> property.
/// </summary>
public static readonly StyledProperty<string> SimpleNumberFormatProperty = AvaloniaProperty.Register<DraggableNumberBox, string>(nameof(SimpleNumberFormat));
/// <summary>
/// Defines the <see cref="Prefix" /> property.
/// </summary>
public static readonly StyledProperty<string?> PrefixProperty = AvaloniaProperty.Register<DraggableNumberBox, string?>(nameof(Prefix));
/// <summary>
/// Defines the <see cref="Suffix" /> property.
/// </summary>
public static readonly StyledProperty<string?> SuffixProperty = AvaloniaProperty.Register<DraggableNumberBox, string?>(nameof(Suffix));
private readonly NumberBox _numberBox;
private TextBox? _inputTextBox;
private double _lastX;
private bool _moved;
private double _startX;
/// <summary>
/// Creates a new instance of the <see cref="DraggableNumberBox" /> class.
/// </summary>
public DraggableNumberBox()
{
InitializeComponent();
_numberBox = this.Get<NumberBox>("NumberBox");
PointerPressed += OnPointerPressed;
PointerMoved += OnPointerMoved;
PointerReleased += OnPointerReleased;
AddHandler(KeyUpEvent, HandleKeyUp, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
}
/// <summary> /// <summary>
/// Gets or sets the value of the number box. /// Gets or sets the value of the number box.
/// </summary> /// </summary>
@ -28,11 +86,6 @@ public partial class DraggableNumberBox : UserControl
set => SetValue(ValueProperty, value); set => SetValue(ValueProperty, value);
} }
/// <summary>
/// Gets or sets the minimum of the number box.
/// </summary>
public static readonly StyledProperty<double> MinimumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Minimum), double.MinValue);
/// <summary> /// <summary>
/// Gets or sets the minimum of the number box. /// Gets or sets the minimum of the number box.
/// </summary> /// </summary>
@ -42,11 +95,6 @@ public partial class DraggableNumberBox : UserControl
set => SetValue(MinimumProperty, value); set => SetValue(MinimumProperty, value);
} }
/// <summary>
/// Gets or sets the maximum of the number box.
/// </summary>
public static readonly StyledProperty<double> MaximumProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(Maximum), double.MaxValue);
/// <summary> /// <summary>
/// Gets or sets the maximum of the number box. /// Gets or sets the maximum of the number box.
/// </summary> /// </summary>
@ -56,67 +104,61 @@ public partial class DraggableNumberBox : UserControl
set => SetValue(MaximumProperty, value); set => SetValue(MaximumProperty, value);
} }
public static readonly StyledProperty<double> LargeChangeProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(LargeChange)); /// <summary>
/// Gets or sets the amount with which to increase/decrease the value when dragging.
/// </summary>
public double LargeChange public double LargeChange
{ {
get => GetValue(LargeChangeProperty); get => GetValue(LargeChangeProperty);
set => SetValue(LargeChangeProperty, value); set => SetValue(LargeChangeProperty, value);
} }
public static readonly StyledProperty<double> SmallChangeProperty = AvaloniaProperty.Register<DraggableNumberBox, double>(nameof(SmallChange)); /// <summary>
/// Gets or sets the amount with which to increase/decrease the value when dragging and holding down shift.
/// </summary>
public double SmallChange public double SmallChange
{ {
get => GetValue(SmallChangeProperty); get => GetValue(SmallChangeProperty);
set => SetValue(SmallChangeProperty, value); set => SetValue(SmallChangeProperty, value);
} }
public static readonly StyledProperty<string> SimpleNumberFormatProperty = AvaloniaProperty.Register<DraggableNumberBox, string>(nameof(SimpleNumberFormat)); /// <summary>
/// Gets or sets the number format string used to format the value into a display value.
/// </summary>
public string SimpleNumberFormat public string SimpleNumberFormat
{ {
get => GetValue(SimpleNumberFormatProperty); get => GetValue(SimpleNumberFormatProperty);
set => SetValue(SimpleNumberFormatProperty, value); set => SetValue(SimpleNumberFormatProperty, value);
} }
public static readonly StyledProperty<string> PrefixProperty = AvaloniaProperty.Register<DraggableNumberBox, string>(nameof(Prefix)); /// <summary>
/// Gets or sets the prefix to show before the value.
public string Prefix /// </summary>
public string? Prefix
{ {
get => GetValue(PrefixProperty); get => GetValue(PrefixProperty);
set => SetValue(PrefixProperty, value); set => SetValue(PrefixProperty, value);
} }
public static readonly StyledProperty<string> SuffixProperty = AvaloniaProperty.Register<DraggableNumberBox, string>(nameof(Suffix)); /// <summary>
/// Gets or sets the affix to show behind the value.
public string Suffix /// </summary>
public string? Suffix
{ {
get => GetValue(SuffixProperty); get => GetValue(SuffixProperty);
set => SetValue(SuffixProperty, value); set => SetValue(SuffixProperty, value);
} }
/// <summary>
/// Occurs when the user starts dragging over the control.
/// </summary>
public event TypedEventHandler<DraggableNumberBox, EventArgs>? DragStarted; public event TypedEventHandler<DraggableNumberBox, EventArgs>? DragStarted;
/// <summary>
/// Occurs when the user finishes dragging over the control.
/// </summary>
public event TypedEventHandler<DraggableNumberBox, EventArgs>? DragFinished; public event TypedEventHandler<DraggableNumberBox, EventArgs>? DragFinished;
private readonly NumberBox _numberBox;
private TextBox? _inputTextBox;
private bool _moved;
private double _lastX;
private double _startX;
public DraggableNumberBox()
{
InitializeComponent();
_numberBox = this.Get<NumberBox>("NumberBox");
PointerPressed += OnPointerPressed;
PointerMoved += OnPointerMoved;
PointerReleased += OnPointerReleased;
AddHandler(KeyUpEvent, HandleKeyUp, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
}
private void HandleKeyUp(object? sender, KeyEventArgs e) private void HandleKeyUp(object? sender, KeyEventArgs e)
{ {
if (e.Key == Key.Enter || e.Key == Key.Escape) if (e.Key == Key.Enter || e.Key == Key.Escape)
@ -184,7 +226,9 @@ public partial class DraggableNumberBox : UserControl
private void OnPointerReleased(object? sender, PointerReleasedEventArgs e) private void OnPointerReleased(object? sender, PointerReleasedEventArgs e)
{ {
if (!_moved) if (!_moved)
{
_inputTextBox?.Focus(); _inputTextBox?.Focus();
}
else else
{ {
_moved = false; _moved = false;

View File

@ -1,4 +1,5 @@
using Avalonia.Controls; using Artemis.UI.Shared.Controls.GradientPicker;
using Avalonia.Controls;
namespace Artemis.UI.Shared.Flyouts; namespace Artemis.UI.Shared.Flyouts;
@ -7,17 +8,17 @@ namespace Artemis.UI.Shared.Flyouts;
/// </summary> /// </summary>
public sealed class GradientPickerFlyout : Flyout public sealed class GradientPickerFlyout : Flyout
{ {
private GradientPicker.GradientPicker? _picker; private GradientPicker? _picker;
/// <summary> /// <summary>
/// Gets the gradient picker that this flyout hosts. /// Gets the gradient picker that this flyout hosts.
/// </summary> /// </summary>
public GradientPicker.GradientPicker GradientPicker => _picker ??= new GradientPicker.GradientPicker(); public GradientPicker GradientPicker => _picker ??= new GradientPicker();
/// <inheritdoc /> /// <inheritdoc />
protected override Control CreatePresenter() protected override Control CreatePresenter()
{ {
_picker ??= new GradientPicker.GradientPicker(); _picker ??= new GradientPicker();
FlyoutPresenter presenter = new() {Content = GradientPicker}; FlyoutPresenter presenter = new() {Content = GradientPicker};
return presenter; return presenter;
} }

View File

@ -16,7 +16,7 @@ using FluentAvalonia.UI.Media;
using ReactiveUI; using ReactiveUI;
using Button = Avalonia.Controls.Button; using Button = Avalonia.Controls.Button;
namespace Artemis.UI.Shared.GradientPicker; namespace Artemis.UI.Shared.Controls.GradientPicker;
/// <summary> /// <summary>
/// Represents a gradient picker that can be used to edit a gradient. /// Represents a gradient picker that can be used to edit a gradient.

View File

@ -13,7 +13,7 @@ using Avalonia.Media;
using FluentAvalonia.Core; using FluentAvalonia.Core;
using Button = FluentAvalonia.UI.Controls.Button; using Button = FluentAvalonia.UI.Controls.Button;
namespace Artemis.UI.Shared.GradientPicker; namespace Artemis.UI.Shared.Controls.GradientPicker;
/// <summary> /// <summary>
/// Represents a gradient picker box that can be used to edit a gradient /// Represents a gradient picker box that can be used to edit a gradient

View File

@ -5,9 +5,9 @@ using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input; using Avalonia.Input;
namespace Artemis.UI.Shared.GradientPicker; namespace Artemis.UI.Shared.Controls.GradientPicker;
public class GradientPickerColorStop : TemplatedControl internal class GradientPickerColorStop : TemplatedControl
{ {
private static ColorGradientStop? _draggingStop; private static ColorGradientStop? _draggingStop;
private static IPointer? _dragPointer; private static IPointer? _dragPointer;

View File

@ -0,0 +1,23 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
namespace Artemis.UI.Shared.Converters;
/// <summary>
/// Converts any object to string by calling its ToString implementation, seems Avalonia doesn't do this
/// </summary>
public class ToStringConverter : IValueConverter
{
/// <inheritdoc />
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value?.ToString();
}
/// <inheritdoc />
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
return value;
}
}

View File

@ -1,11 +1,18 @@
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using SkiaSharp;
namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display namespace Artemis.UI.Shared.DefaultTypes.DataModel.Display
{ {
/// <summary>
/// Represents a data model display view used to display <see cref="SKColor" /> values.
/// </summary>
public partial class SKColorDataModelDisplayView : UserControl public partial class SKColorDataModelDisplayView : UserControl
{ {
/// <summary>
/// Creates a new instance of the <see cref="SKColorDataModelDisplayView"/> class.
/// </summary>
public SKColorDataModelDisplayView() public SKColorDataModelDisplayView()
{ {
InitializeComponent(); InitializeComponent();

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia;
namespace Artemis.UI.Shared.Extensions
{
public static class PointExtensions
{
public static Point Empty = new(0, 0);
}
}

View File

@ -3,8 +3,16 @@ using SkiaSharp;
namespace Artemis.UI.Shared.Extensions; namespace Artemis.UI.Shared.Extensions;
/// <summary>
/// Provides utility methods when working with SkiaSharp matrices.
/// </summary>
public static class SKMatrixExtensions public static class SKMatrixExtensions
{ {
/// <summary>
/// Converts the matrix to an Avalonia <see cref="Matrix" />.
/// </summary>
/// <param name="matrix">The matrix to convert.</param>
/// <returns>The resulting Avalonia <see cref="Matrix" />.</returns>
public static Matrix ToMatrix(this SKMatrix matrix) public static Matrix ToMatrix(this SKMatrix matrix)
{ {
return new Matrix( return new Matrix(

View File

@ -3,13 +3,26 @@ using SkiaSharp;
namespace Artemis.UI.Shared.Extensions; namespace Artemis.UI.Shared.Extensions;
/// <summary>
/// Provides utility methods when working with SkiaSharp rectangles.
/// </summary>
public static class SKRectExtensions public static class SKRectExtensions
{ {
/// <summary>
/// Converts the rectangle to an Avalonia <see cref="Rect" />.
/// </summary>
/// <param name="rect">The rectangle to convert.</param>
/// <returns>The resulting Avalonia <see cref="Rect" />.</returns>
public static Rect ToRect(this SKRect rect) public static Rect ToRect(this SKRect rect)
{ {
return new Rect(rect.Left, rect.Top, rect.Width, rect.Height); return new Rect(rect.Left, rect.Top, rect.Width, rect.Height);
} }
/// <summary>
/// Converts the integer rectangle to an Avalonia <see cref="Rect" />.
/// </summary>
/// <param name="rect">The integer rectangle to convert.</param>
/// <returns>The resulting Avalonia <see cref="Rect" />.</returns>
public static Rect ToRect(this SKRectI rect) public static Rect ToRect(this SKRectI rect)
{ {
return new Rect(rect.Left, rect.Top, rect.Width, rect.Height); return new Rect(rect.Left, rect.Top, rect.Width, rect.Height);

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
@ -65,6 +66,8 @@ namespace Artemis.UI.Shared.Services.Builders
{ {
FileDialogFilterBuilder builder = new(); FileDialogFilterBuilder builder = new();
configure(builder); configure(builder);
_openFileDialog.Filters ??= new List<FileDialogFilter>();
_openFileDialog.Filters.Add(builder.Build()); _openFileDialog.Filters.Add(builder.Build());
return this; return this;

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
@ -65,6 +66,8 @@ namespace Artemis.UI.Shared.Services.Builders
{ {
FileDialogFilterBuilder builder = new(); FileDialogFilterBuilder builder = new();
configure(builder); configure(builder);
_saveFileDialog.Filters ??= new List<FileDialogFilter>();
_saveFileDialog.Filters.Add(builder.Build()); _saveFileDialog.Filters.Add(builder.Build());
return this; return this;

View File

@ -1,9 +0,0 @@
namespace Artemis.UI.Shared.Services;
public class GradientPickerService : IGradientPickerService
{
}
public interface IGradientPickerService : IArtemisSharedUIService
{
}

View File

@ -4,6 +4,9 @@ using Artemis.UI.Shared.Services.ProfileEditor;
namespace Artemis.UI.Shared.Services.NodeEditor; namespace Artemis.UI.Shared.Services.NodeEditor;
/// <summary>
/// Represents a service that can be used to execute editor commands on node scripts.
/// </summary>
public interface INodeEditorService : IArtemisSharedUIService public interface INodeEditorService : IArtemisSharedUIService
{ {
/// <summary> /// <summary>

View File

@ -9,6 +9,9 @@ using ReactiveUI;
namespace Artemis.UI.Shared.Services.NodeEditor; namespace Artemis.UI.Shared.Services.NodeEditor;
/// <summary>
/// Represents the command history of a node script.
/// </summary>
public class NodeEditorHistory public class NodeEditorHistory
{ {
private readonly Subject<bool> _canRedo = new(); private readonly Subject<bool> _canRedo = new();
@ -16,6 +19,10 @@ public class NodeEditorHistory
private readonly Stack<INodeEditorCommand> _redoCommands = new(); private readonly Stack<INodeEditorCommand> _redoCommands = new();
private readonly Stack<INodeEditorCommand> _undoCommands = new(); private readonly Stack<INodeEditorCommand> _undoCommands = new();
/// <summary>
/// Creates a new instance of the <see cref="NodeEditorHistory" /> class.
/// </summary>
/// <param name="nodeScript">The node script the history relates to.</param>
public NodeEditorHistory(INodeScript nodeScript) public NodeEditorHistory(INodeScript nodeScript)
{ {
NodeScript = nodeScript; NodeScript = nodeScript;
@ -25,14 +32,39 @@ public class NodeEditorHistory
Redo = ReactiveCommand.Create(ExecuteRedo, CanRedo); Redo = ReactiveCommand.Create(ExecuteRedo, CanRedo);
} }
/// <summary>
/// Gets the node script the history relates to.
/// </summary>
public INodeScript NodeScript { get; } public INodeScript NodeScript { get; }
/// <summary>
/// Gets an observable sequence containing a boolean value indicating whether history can be undone.
/// </summary>
public IObservable<bool> CanUndo => _canUndo.AsObservable().DistinctUntilChanged(); public IObservable<bool> CanUndo => _canUndo.AsObservable().DistinctUntilChanged();
/// <summary>
/// Gets an observable sequence containing a boolean value indicating whether history can be redone.
/// </summary>
public IObservable<bool> CanRedo => _canRedo.AsObservable().DistinctUntilChanged(); public IObservable<bool> CanRedo => _canRedo.AsObservable().DistinctUntilChanged();
/// <summary>
/// Gets a reactive command that can be executed to execute an instance of a <see cref="INodeEditorCommand" /> and puts it in history.
/// </summary>
public ReactiveCommand<INodeEditorCommand, Unit> Execute { get; } public ReactiveCommand<INodeEditorCommand, Unit> Execute { get; }
/// <summary>
/// Gets a reactive command that can be executed to undo history.
/// </summary>
public ReactiveCommand<Unit, INodeEditorCommand?> Undo { get; } public ReactiveCommand<Unit, INodeEditorCommand?> Undo { get; }
/// <summary>
/// Gets a reactive command that can be executed to redo history.
/// </summary>
public ReactiveCommand<Unit, INodeEditorCommand?> Redo { get; } public ReactiveCommand<Unit, INodeEditorCommand?> Redo { get; }
/// <summary>
/// Clears the history.
/// </summary>
public void Clear() public void Clear()
{ {
ClearRedo(); ClearRedo();
@ -40,6 +72,10 @@ public class NodeEditorHistory
UpdateSubjects(); UpdateSubjects();
} }
/// <summary>
/// Executes the provided <paramref name="command" /> and puts it in history.
/// </summary>
/// <param name="command">The command to execute</param>
public void ExecuteEditorCommand(INodeEditorCommand command) public void ExecuteEditorCommand(INodeEditorCommand command)
{ {
command.Execute(); command.Execute();

View File

@ -9,6 +9,9 @@ using ReactiveUI;
namespace Artemis.UI.Shared.Services.ProfileEditor; namespace Artemis.UI.Shared.Services.ProfileEditor;
/// <summary>
/// Represents the command history of a profile configuration.
/// </summary>
public class ProfileEditorHistory public class ProfileEditorHistory
{ {
private readonly Subject<bool> _canRedo = new(); private readonly Subject<bool> _canRedo = new();
@ -16,6 +19,10 @@ public class ProfileEditorHistory
private readonly Stack<IProfileEditorCommand> _redoCommands = new(); private readonly Stack<IProfileEditorCommand> _redoCommands = new();
private readonly Stack<IProfileEditorCommand> _undoCommands = new(); private readonly Stack<IProfileEditorCommand> _undoCommands = new();
/// <summary>
/// Creates a new instance of the <see cref="ProfileEditorHistory" /> class.
/// </summary>
/// <param name="profileConfiguration">The profile configuration the history relates to.</param>
public ProfileEditorHistory(ProfileConfiguration profileConfiguration) public ProfileEditorHistory(ProfileConfiguration profileConfiguration)
{ {
ProfileConfiguration = profileConfiguration; ProfileConfiguration = profileConfiguration;
@ -25,14 +32,39 @@ public class ProfileEditorHistory
Redo = ReactiveCommand.Create(ExecuteRedo, CanRedo); Redo = ReactiveCommand.Create(ExecuteRedo, CanRedo);
} }
/// <summary>
/// Gets the profile configuration the history relates to.
/// </summary>
public ProfileConfiguration ProfileConfiguration { get; } public ProfileConfiguration ProfileConfiguration { get; }
/// <summary>
/// Gets an observable sequence containing a boolean value indicating whether history can be undone.
/// </summary>
public IObservable<bool> CanUndo => _canUndo.AsObservable().DistinctUntilChanged(); public IObservable<bool> CanUndo => _canUndo.AsObservable().DistinctUntilChanged();
/// <summary>
/// Gets an observable sequence containing a boolean value indicating whether history can be redone.
/// </summary>
public IObservable<bool> CanRedo => _canRedo.AsObservable().DistinctUntilChanged(); public IObservable<bool> CanRedo => _canRedo.AsObservable().DistinctUntilChanged();
/// <summary>
/// Gets a reactive command that can be executed to execute an instance of a <see cref="IProfileEditorCommand" /> and puts it in history.
/// </summary>
public ReactiveCommand<IProfileEditorCommand, Unit> Execute { get; } public ReactiveCommand<IProfileEditorCommand, Unit> Execute { get; }
/// <summary>
/// Gets a reactive command that can be executed to undo history.
/// </summary>
public ReactiveCommand<Unit, IProfileEditorCommand?> Undo { get; } public ReactiveCommand<Unit, IProfileEditorCommand?> Undo { get; }
/// <summary>
/// Gets a reactive command that can be executed to redo history.
/// </summary>
public ReactiveCommand<Unit, IProfileEditorCommand?> Redo { get; } public ReactiveCommand<Unit, IProfileEditorCommand?> Redo { get; }
/// <summary>
/// Clears the history.
/// </summary>
public void Clear() public void Clear()
{ {
ClearRedo(); ClearRedo();
@ -40,6 +72,10 @@ public class ProfileEditorHistory
UpdateSubjects(); UpdateSubjects();
} }
/// <summary>
/// Executes the provided <paramref name="command" /> and puts it in history.
/// </summary>
/// <param name="command">The command to execute</param>
public void ExecuteEditorCommand(IProfileEditorCommand command) public void ExecuteEditorCommand(IProfileEditorCommand command)
{ {
command.Execute(); command.Execute();
@ -52,8 +88,10 @@ public class ProfileEditorHistory
private void ClearRedo() private void ClearRedo()
{ {
foreach (IProfileEditorCommand profileEditorCommand in _redoCommands) foreach (IProfileEditorCommand profileEditorCommand in _redoCommands)
{
if (profileEditorCommand is IDisposable disposable) if (profileEditorCommand is IDisposable disposable)
disposable.Dispose(); disposable.Dispose();
}
_redoCommands.Clear(); _redoCommands.Clear();
} }
@ -61,8 +99,10 @@ public class ProfileEditorHistory
private void ClearUndo() private void ClearUndo()
{ {
foreach (IProfileEditorCommand profileEditorCommand in _undoCommands) foreach (IProfileEditorCommand profileEditorCommand in _undoCommands)
{
if (profileEditorCommand is IDisposable disposable) if (profileEditorCommand is IDisposable disposable)
disposable.Dispose(); disposable.Dispose();
}
_undoCommands.Clear(); _undoCommands.Clear();
} }

View File

@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Reactive.Disposables; using System.Reactive.Disposables;
using System.Reactive.Linq; using System.Reactive.Linq;
using Artemis.Core; using Artemis.Core;
using Artemis.UI.Shared.Controls;
using Artemis.UI.Shared.Services.ProfileEditor; using Artemis.UI.Shared.Services.ProfileEditor;
using Artemis.UI.Shared.Services.ProfileEditor.Commands; using Artemis.UI.Shared.Services.ProfileEditor.Commands;
using Avalonia.Threading; using Avalonia.Threading;
@ -79,7 +80,7 @@ public abstract class PropertyInputViewModel<T> : PropertyInputViewModel
/// <summary> /// <summary>
/// Gets or boolean indicating whether the current input is being previewed, the value won't be applied until /// Gets or boolean indicating whether the current input is being previewed, the value won't be applied until
/// <para> /// <para>
/// Only applicable when using something like a <see cref="DraggableFloat" />, see /// Only applicable when using something like a <see cref="DraggableNumberBox" />, see
/// <see cref="StartPreview" /> and <see cref="ApplyPreview" /> /// <see cref="StartPreview" /> and <see cref="ApplyPreview" />
/// </para> /// </para>
/// </summary> /// </summary>

View File

@ -1,10 +1,10 @@
<Styles xmlns="https://github.com/avaloniaui" <Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker"
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker" xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker"
xmlns:controls1="clr-namespace:Artemis.UI.Shared" xmlns:controls1="clr-namespace:Artemis.UI.Shared"
xmlns:controls2="clr-namespace:Artemis.UI.Shared.Controls"> xmlns:controls2="clr-namespace:Artemis.UI.Shared.Controls"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker">
<Design.PreviewWith> <Design.PreviewWith>
<Border Padding="50"> <Border Padding="50">
<StackPanel Spacing="5"> <StackPanel Spacing="5">

View File

@ -2,7 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker" xmlns:dataModelPicker="clr-namespace:Artemis.UI.Shared.DataModelPicker"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker"> xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker">
<Design.PreviewWith> <Design.PreviewWith>
<Border Padding="20" Width="200"> <Border Padding="20" Width="200">
<StackPanel Spacing="5"> <StackPanel Spacing="5">

View File

@ -4,7 +4,7 @@
xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core" xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core"
xmlns:fluent="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:fluent="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:converters="clr-namespace:Artemis.UI.Shared.Converters" xmlns:converters="clr-namespace:Artemis.UI.Shared.Converters"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker"> xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker">
<Styles.Resources> <Styles.Resources>
<VisualBrush x:Key="LightCheckerboardBrush" TileMode="Tile" Stretch="Uniform" DestinationRect="3,0,10,10"> <VisualBrush x:Key="LightCheckerboardBrush" TileMode="Tile" Stretch="Uniform" DestinationRect="3,0,10,10">
<VisualBrush.Visual> <VisualBrush.Visual>

View File

@ -1,7 +1,7 @@
<Styles xmlns="https://github.com/avaloniaui" <Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker"> xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker">
<Design.PreviewWith> <Design.PreviewWith>
<Border Padding="20" Width="200"> <Border Padding="20" Width="200">
<StackPanel Spacing="5"> <StackPanel Spacing="5">

View File

@ -1,4 +1,6 @@
using System; #nullable disable
using System;
using SharpVk; using SharpVk;
using SharpVk.Khronos; using SharpVk.Khronos;
using SkiaSharp; using SkiaSharp;

View File

@ -3,7 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput" xmlns:propertyInput="clr-namespace:Artemis.UI.DefaultTypes.PropertyInput"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker;assembly=Artemis.UI.Shared" xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker;assembly=Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.DefaultTypes.PropertyInput.ColorGradientPropertyInputView" x:Class="Artemis.UI.DefaultTypes.PropertyInput.ColorGradientPropertyInputView"
x:DataType="propertyInput:ColorGradientPropertyInputViewModel"> x:DataType="propertyInput:ColorGradientPropertyInputViewModel">

View File

@ -1,5 +1,5 @@
using System; using System;
using Artemis.UI.Shared.GradientPicker; using Artemis.UI.Shared.Controls.GradientPicker;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI; using Avalonia.ReactiveUI;

View File

@ -51,19 +51,12 @@
<GridSplitter Grid.Column="1" Width="15" Margin="-15 0 0 0" Background="Transparent" HorizontalAlignment="Stretch" /> <GridSplitter Grid.Column="1" Width="15" Margin="-15 0 0 0" Background="Transparent" HorizontalAlignment="Stretch" />
<Border Grid.Column="2" Classes="card-condensed" CornerRadius="10 0 0 0" Margin="0 10 0 0" Background="#ff323232"> <Border Grid.Column="2" Classes="card-condensed" CornerRadius="10 0 0 0" Margin="0 10 0 0" Background="#ff323232">
<TabControl Items="{CompiledBinding Tabs}"> <TabControl Items="{CompiledBinding Tabs}" Padding="12">
<TabControl.ItemTemplate> <TabControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<TextBlock Text="{CompiledBinding DisplayName}" /> <TextBlock Text="{CompiledBinding DisplayName}" />
</DataTemplate> </DataTemplate>
</TabControl.ItemTemplate> </TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<ContentControl Content="{Binding}" Margin="0 12" />
</ScrollViewer>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl> </TabControl>
</Border> </Border>

View File

@ -5,6 +5,7 @@
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Device.DeviceInfoTabView"> x:Class="Artemis.UI.Screens.Device.DeviceInfoTabView">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<Grid RowDefinitions="Auto,*" ColumnDefinitions="*,*" Margin="-5"> <Grid RowDefinitions="Auto,*" ColumnDefinitions="*,*" Margin="-5">
<!-- First row --> <!-- First row -->
<Border Classes="card" Grid.Column="0" Grid.Row="0" Margin="5"> <Border Classes="card" Grid.Column="0" Grid.Row="0" Margin="5">
@ -82,4 +83,6 @@
</StackPanel> </StackPanel>
</Border> </Border>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -0,0 +1,46 @@
using System.Collections.ObjectModel;
using Artemis.Core;
using Artemis.UI.Shared;
using RGB.NET.Core;
namespace Artemis.UI.Screens.Device;
public class DeviceLedsTabLedViewModel : ViewModelBase
{
private readonly ObservableCollection<ArtemisLed> _selectedLeds;
private bool _isSelected;
public DeviceLedsTabLedViewModel(ArtemisLed artemisLed, ObservableCollection<ArtemisLed> selectedLeds)
{
_selectedLeds = selectedLeds;
ArtemisLed = artemisLed;
Update();
}
public ArtemisLed ArtemisLed { get; }
public bool IsSelected
{
get => _isSelected;
set
{
if (!RaiseAndSetIfChanged(ref _isSelected, value))
return;
Apply();
}
}
public void Update()
{
IsSelected = _selectedLeds.Contains(ArtemisLed);
}
public void Apply()
{
if (IsSelected && !_selectedLeds.Contains(ArtemisLed))
_selectedLeds.Add(ArtemisLed);
else if (!IsSelected && _selectedLeds.Contains(ArtemisLed))
_selectedLeds.Remove(ArtemisLed);
}
}

View File

@ -2,7 +2,27 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:device="clr-namespace:Artemis.UI.Screens.Device"
xmlns:converters="clr-namespace:Artemis.UI.Converters"
xmlns:shared="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Device.DeviceLedsTabView"> x:Class="Artemis.UI.Screens.Device.DeviceLedsTabView"
Welcome to Avalonia! x:DataType="device:DeviceLedsTabViewModel">
<UserControl.Resources>
<converters:UriToFileNameConverter x:Key="UriToFileNameConverter" />
<converters:LedIdToStringConverter x:Key="LedIdToStringConverter" />
<shared:ToStringConverter x:Key="ToStringConverter" />
</UserControl.Resources>
<DataGrid Items="{CompiledBinding LedViewModels}" CanUserSortColumns="True" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{Binding IsSelected, Mode=TwoWay}" CanUserSort="False" CanUserReorder="False" Header="Highlight" />
<DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Id, Converter={StaticResource LedIdToStringConverter}, Mode=OneWay}" Header="LED ID" Width="Auto" />
<DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Color, Converter={StaticResource ToStringConverter}, Mode=OneWay}" Header="Color (ARGB)" Width="Auto" CanUserSort="False" />
<DataGridTextColumn Binding="{Binding ArtemisLed.Layout.Image, Converter={StaticResource UriToFileNameConverter}, Mode=OneWay}" Header="Image file" CanUserSort="False" />
<DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Shape}" Header="Shape" />
<DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Location, Converter={StaticResource ToStringConverter}, Mode=OneWay}" Header="Location" Width="Auto" CanUserSort="False" />
<DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.Size, Converter={StaticResource ToStringConverter}, Mode=OneWay}" Header="Size" Width="Auto" CanUserSort="False" />
<DataGridTextColumn Binding="{Binding ArtemisLed.RgbLed.CustomData}" Header="LED data" Width="Auto" />
</DataGrid.Columns>
</DataGrid>
</UserControl> </UserControl>

View File

@ -39,44 +39,4 @@ namespace Artemis.UI.Screens.Device
deviceLedsTabLedViewModel.Update(); deviceLedsTabLedViewModel.Update();
} }
} }
public class DeviceLedsTabLedViewModel : ViewModelBase
{
private readonly ObservableCollection<ArtemisLed> _selectedLeds;
private bool _isSelected;
public DeviceLedsTabLedViewModel(ArtemisLed artemisLed, ObservableCollection<ArtemisLed> selectedLeds)
{
_selectedLeds = selectedLeds;
ArtemisLed = artemisLed;
Update();
}
public ArtemisLed ArtemisLed { get; }
public bool IsSelected
{
get => _isSelected;
set
{
if (!RaiseAndSetIfChanged(ref _isSelected, value))
return;
Apply();
}
}
public void Update()
{
IsSelected = _selectedLeds.Contains(ArtemisLed);
}
public void Apply()
{
if (IsSelected && !_selectedLeds.Contains(ArtemisLed))
_selectedLeds.Add(ArtemisLed);
else if (!IsSelected && _selectedLeds.Contains(ArtemisLed))
_selectedLeds.Remove(ArtemisLed);
}
}
} }

View File

@ -15,6 +15,7 @@
<device:DevicePropertiesTabViewModel /> <device:DevicePropertiesTabViewModel />
</Design.DataContext> </Design.DataContext>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<!-- Body --> <!-- Body -->
<Grid RowDefinitions="*,Auto"> <Grid RowDefinitions="*,Auto">
<StackPanel Grid.Row="0"> <StackPanel Grid.Row="0">
@ -196,4 +197,5 @@
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,12 +7,8 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.Device.InputMappingsTabView" x:Class="Artemis.UI.Screens.Device.InputMappingsTabView"
x:DataType="device:InputMappingsTabViewModel"> x:DataType="device:InputMappingsTabViewModel">
<Grid> <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<Grid.RowDefinitions> <Grid RowDefinitions="Auto,Auto,*">
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"> <StackPanel Grid.Row="0">
<TextBlock Classes="h4"> <TextBlock Classes="h4">
Introduction Introduction
@ -71,4 +67,5 @@
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
</Grid> </Grid>
</ScrollViewer>
</UserControl> </UserControl>

View File

@ -7,8 +7,8 @@
xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties;assembly=Artemis.UI.Shared" xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties;assembly=Artemis.UI.Shared"
xmlns:workshop="clr-namespace:Artemis.UI.Screens.Workshop" xmlns:workshop="clr-namespace:Artemis.UI.Screens.Workshop"
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared" xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.GradientPicker;assembly=Artemis.UI.Shared"
xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared" xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared"
xmlns:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker;assembly=Artemis.UI.Shared"
mc:Ignorable="d" d:DesignWidth="800" mc:Ignorable="d" d:DesignWidth="800"
x:Class="Artemis.UI.Screens.Workshop.WorkshopView" x:Class="Artemis.UI.Screens.Workshop.WorkshopView"
x:DataType="workshop:WorkshopViewModel"> x:DataType="workshop:WorkshopViewModel">