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:
parent
021f17aef4
commit
65837e671a
3
src/.idea/.idea.Artemis/.idea/avalonia.xml
generated
3
src/.idea/.idea.Artemis/.idea/avalonia.xml
generated
@ -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/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/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/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" />
|
||||
@ -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/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/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/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" />
|
||||
|
||||
@ -153,7 +153,18 @@ namespace Artemis.Core.Services
|
||||
/// <param name="color">The color to display</param>
|
||||
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);
|
||||
|
||||
/// <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);
|
||||
}
|
||||
}
|
||||
@ -6,19 +6,29 @@
|
||||
<members>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.ArtemisIcon.IconProperty">
|
||||
<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
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Artemis.UI.Avalonia.Shared.Controls.ArtemisIcon.Icon">
|
||||
<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
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.#ctor">
|
||||
@ -34,18 +44,24 @@
|
||||
</member>
|
||||
<member name="M:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.OnLedClicked(Artemis.UI.Avalonia.Shared.Events.LedClickedEventArgs)">
|
||||
<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>
|
||||
<param name="e"></param>
|
||||
</member>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.DeviceProperty">
|
||||
<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>
|
||||
</member>
|
||||
<member name="P:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.Device">
|
||||
<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>
|
||||
</member>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.DeviceVisualizer.ShowColorsProperty">
|
||||
@ -95,37 +111,51 @@
|
||||
</member>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.ProfileConfigurationIcon.ConfigurationIconProperty">
|
||||
<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>
|
||||
</member>
|
||||
<member name="P:Artemis.UI.Avalonia.Shared.Controls.ProfileConfigurationIcon.ConfigurationIcon">
|
||||
<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>
|
||||
</member>
|
||||
<member name="T:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle">
|
||||
<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>
|
||||
</member>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BackgroundProperty">
|
||||
<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>
|
||||
</member>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderBrushProperty">
|
||||
<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>
|
||||
</member>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.BorderThicknessProperty">
|
||||
<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>
|
||||
</member>
|
||||
<member name="F:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.InputElementProperty">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:Artemis.UI.Avalonia.Shared.Controls.SelectionRectangle.#ctor">
|
||||
@ -154,7 +184,9 @@
|
||||
</member>
|
||||
<member name="T:Artemis.UI.Avalonia.Shared.Converters.ColorToSKColorConverter">
|
||||
<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>
|
||||
</member>
|
||||
<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 name="T:Artemis.UI.Avalonia.Shared.Converters.SKColorToColorConverter">
|
||||
<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>
|
||||
</member>
|
||||
<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 name="T:Artemis.UI.Avalonia.Shared.Events.DataModelInputDynamicEventArgs">
|
||||
<summary>
|
||||
Provides data about selection events raised by <see cref="!:DataModelDynamicViewModel" />
|
||||
Provides data about selection events raised by
|
||||
<see cref="!:DataModelDynamicViewModel"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Artemis.UI.Avalonia.Shared.Events.DataModelInputDynamicEventArgs.DataModelPath">
|
||||
@ -186,7 +221,8 @@
|
||||
</member>
|
||||
<member name="T:Artemis.UI.Avalonia.Shared.Events.DataModelInputStaticEventArgs">
|
||||
<summary>
|
||||
Provides data about submit events raised by <see cref="!:DataModelStaticViewModel" />
|
||||
Provides data about submit events raised by
|
||||
<see cref="!:DataModelStaticViewModel"/>
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Artemis.UI.Avalonia.Shared.Events.DataModelInputStaticEventArgs.Value">
|
||||
@ -246,7 +282,9 @@
|
||||
</member>
|
||||
<member name="T:Artemis.UI.Avalonia.Shared.Ninject.SharedUIModule">
|
||||
<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>
|
||||
</member>
|
||||
<member name="M:Artemis.UI.Avalonia.Shared.Ninject.SharedUIModule.Load">
|
||||
@ -273,7 +311,9 @@
|
||||
</member>
|
||||
<member name="M:Artemis.UI.Avalonia.Shared.PluginConfigurationViewModel.#ctor(Artemis.Core.Plugin)">
|
||||
<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>
|
||||
<param name="plugin"></param>
|
||||
</member>
|
||||
@ -397,7 +437,9 @@
|
||||
</member>
|
||||
<member name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowWindow``1(System.ValueTuple{System.String,System.Object}[])">
|
||||
<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>
|
||||
<typeparam name="TViewModel">The type of view model to create</typeparam>
|
||||
<returns>The created view model</returns>
|
||||
@ -421,15 +463,21 @@
|
||||
</summary>
|
||||
<typeparam name="TResult">The return type</typeparam>
|
||||
<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 name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowDialogAsync``2(System.ValueTuple{System.String,System.Object}[])">
|
||||
<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>
|
||||
<typeparam name="TViewModel">The view model 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 name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.ShowConfirmContentDialog(System.String,System.String,System.String,System.String)">
|
||||
<summary>
|
||||
@ -438,8 +486,15 @@
|
||||
<param name="title">The title 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="cancel">The text of the cancel button, if <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>
|
||||
<param name="cancel">The text of the cancel button, if
|
||||
<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 name="M:Artemis.UI.Avalonia.Shared.Services.Interfaces.IWindowService.CreateOpenFileDialog">
|
||||
<summary>
|
||||
@ -476,8 +531,10 @@
|
||||
Releases the unmanaged resources used by the object and optionally releases the managed resources.
|
||||
</summary>
|
||||
<param name="disposing">
|
||||
<see langword="true" /> to release both managed and unmanaged resources;
|
||||
<see langword="false" /> to release only unmanaged resources.
|
||||
<see langword="true"/>
|
||||
to release both managed and unmanaged resources;
|
||||
<see langword="false"/>
|
||||
to release only unmanaged resources.
|
||||
</param>
|
||||
</member>
|
||||
<member name="P:Artemis.UI.Avalonia.Shared.ActivatableViewModelBase.Activator">
|
||||
@ -493,7 +550,8 @@
|
||||
</member>
|
||||
<member name="M:Artemis.UI.Avalonia.Shared.DialogViewModelBase`1.Close(`0)">
|
||||
<summary>
|
||||
Closes the dialog with the given <paramref name="result" />
|
||||
Closes the dialog with the given
|
||||
<paramref name="result"/>
|
||||
</summary>
|
||||
<param name="result">The result of the dialog</param>
|
||||
</member>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
@ -12,13 +11,72 @@ using FluentAvalonia.UI.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>
|
||||
/// Gets or sets the value of the number box.
|
||||
/// Defines the <see cref="Value" /> property.
|
||||
/// </summary>
|
||||
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>
|
||||
/// Gets or sets the value of the number box.
|
||||
/// </summary>
|
||||
@ -28,11 +86,6 @@ public partial class DraggableNumberBox : UserControl
|
||||
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>
|
||||
/// Gets or sets the minimum of the number box.
|
||||
/// </summary>
|
||||
@ -42,11 +95,6 @@ public partial class DraggableNumberBox : UserControl
|
||||
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>
|
||||
/// Gets or sets the maximum of the number box.
|
||||
/// </summary>
|
||||
@ -56,67 +104,61 @@ public partial class DraggableNumberBox : UserControl
|
||||
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
|
||||
{
|
||||
get => GetValue(LargeChangeProperty);
|
||||
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
|
||||
{
|
||||
get => GetValue(SmallChangeProperty);
|
||||
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
|
||||
{
|
||||
get => GetValue(SimpleNumberFormatProperty);
|
||||
set => SetValue(SimpleNumberFormatProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> PrefixProperty = AvaloniaProperty.Register<DraggableNumberBox, string>(nameof(Prefix));
|
||||
|
||||
public string Prefix
|
||||
/// <summary>
|
||||
/// Gets or sets the prefix to show before the value.
|
||||
/// </summary>
|
||||
public string? Prefix
|
||||
{
|
||||
get => GetValue(PrefixProperty);
|
||||
set => SetValue(PrefixProperty, value);
|
||||
}
|
||||
|
||||
public static readonly StyledProperty<string> SuffixProperty = AvaloniaProperty.Register<DraggableNumberBox, string>(nameof(Suffix));
|
||||
|
||||
public string Suffix
|
||||
/// <summary>
|
||||
/// Gets or sets the affix to show behind the value.
|
||||
/// </summary>
|
||||
public string? Suffix
|
||||
{
|
||||
get => GetValue(SuffixProperty);
|
||||
set => SetValue(SuffixProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the user starts dragging over the control.
|
||||
/// </summary>
|
||||
public event TypedEventHandler<DraggableNumberBox, EventArgs>? DragStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the user finishes dragging over the control.
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (!_moved)
|
||||
{
|
||||
_inputTextBox?.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
_moved = false;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Avalonia.Controls;
|
||||
using Artemis.UI.Shared.Controls.GradientPicker;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Artemis.UI.Shared.Flyouts;
|
||||
|
||||
@ -7,17 +8,17 @@ namespace Artemis.UI.Shared.Flyouts;
|
||||
/// </summary>
|
||||
public sealed class GradientPickerFlyout : Flyout
|
||||
{
|
||||
private GradientPicker.GradientPicker? _picker;
|
||||
private GradientPicker? _picker;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the gradient picker that this flyout hosts.
|
||||
/// </summary>
|
||||
public GradientPicker.GradientPicker GradientPicker => _picker ??= new GradientPicker.GradientPicker();
|
||||
public GradientPicker GradientPicker => _picker ??= new GradientPicker();
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override Control CreatePresenter()
|
||||
{
|
||||
_picker ??= new GradientPicker.GradientPicker();
|
||||
_picker ??= new GradientPicker();
|
||||
FlyoutPresenter presenter = new() {Content = GradientPicker};
|
||||
return presenter;
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ using FluentAvalonia.UI.Media;
|
||||
using ReactiveUI;
|
||||
using Button = Avalonia.Controls.Button;
|
||||
|
||||
namespace Artemis.UI.Shared.GradientPicker;
|
||||
namespace Artemis.UI.Shared.Controls.GradientPicker;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a gradient picker that can be used to edit a gradient.
|
||||
|
||||
@ -13,7 +13,7 @@ using Avalonia.Media;
|
||||
using FluentAvalonia.Core;
|
||||
using Button = FluentAvalonia.UI.Controls.Button;
|
||||
|
||||
namespace Artemis.UI.Shared.GradientPicker;
|
||||
namespace Artemis.UI.Shared.Controls.GradientPicker;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a gradient picker box that can be used to edit a gradient
|
||||
|
||||
@ -5,9 +5,9 @@ using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
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 IPointer? _dragPointer;
|
||||
|
||||
23
src/Artemis.UI.Shared/Converters/ToStringConverter.cs
Normal file
23
src/Artemis.UI.Shared/Converters/ToStringConverter.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,18 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using SkiaSharp;
|
||||
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="SKColorDataModelDisplayView"/> class.
|
||||
/// </summary>
|
||||
public SKColorDataModelDisplayView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -3,8 +3,16 @@ using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Shared.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides utility methods when working with SkiaSharp matrices.
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
return new Matrix(
|
||||
|
||||
@ -3,13 +3,26 @@ using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Shared.Extensions;
|
||||
|
||||
/// <summary>
|
||||
/// Provides utility methods when working with SkiaSharp rectangles.
|
||||
/// </summary>
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return new Rect(rect.Left, rect.Top, rect.Width, rect.Height);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
|
||||
@ -65,6 +66,8 @@ namespace Artemis.UI.Shared.Services.Builders
|
||||
{
|
||||
FileDialogFilterBuilder builder = new();
|
||||
configure(builder);
|
||||
|
||||
_openFileDialog.Filters ??= new List<FileDialogFilter>();
|
||||
_openFileDialog.Filters.Add(builder.Build());
|
||||
|
||||
return this;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
|
||||
@ -65,6 +66,8 @@ namespace Artemis.UI.Shared.Services.Builders
|
||||
{
|
||||
FileDialogFilterBuilder builder = new();
|
||||
configure(builder);
|
||||
|
||||
_saveFileDialog.Filters ??= new List<FileDialogFilter>();
|
||||
_saveFileDialog.Filters.Add(builder.Build());
|
||||
|
||||
return this;
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
namespace Artemis.UI.Shared.Services;
|
||||
|
||||
public class GradientPickerService : IGradientPickerService
|
||||
{
|
||||
}
|
||||
|
||||
public interface IGradientPickerService : IArtemisSharedUIService
|
||||
{
|
||||
}
|
||||
@ -4,6 +4,9 @@ using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -9,6 +9,9 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.NodeEditor;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the command history of a node script.
|
||||
/// </summary>
|
||||
public class NodeEditorHistory
|
||||
{
|
||||
private readonly Subject<bool> _canRedo = new();
|
||||
@ -16,6 +19,10 @@ public class NodeEditorHistory
|
||||
private readonly Stack<INodeEditorCommand> _redoCommands = 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)
|
||||
{
|
||||
NodeScript = nodeScript;
|
||||
@ -25,14 +32,39 @@ public class NodeEditorHistory
|
||||
Redo = ReactiveCommand.Create(ExecuteRedo, CanRedo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the node script the history relates to.
|
||||
/// </summary>
|
||||
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();
|
||||
|
||||
/// <summary>
|
||||
/// Gets an observable sequence containing a boolean value indicating whether history can be redone.
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reactive command that can be executed to undo history.
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// Clears the history.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
ClearRedo();
|
||||
@ -40,6 +72,10 @@ public class NodeEditorHistory
|
||||
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)
|
||||
{
|
||||
command.Execute();
|
||||
|
||||
@ -9,6 +9,9 @@ using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Shared.Services.ProfileEditor;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the command history of a profile configuration.
|
||||
/// </summary>
|
||||
public class ProfileEditorHistory
|
||||
{
|
||||
private readonly Subject<bool> _canRedo = new();
|
||||
@ -16,6 +19,10 @@ public class ProfileEditorHistory
|
||||
private readonly Stack<IProfileEditorCommand> _redoCommands = 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)
|
||||
{
|
||||
ProfileConfiguration = profileConfiguration;
|
||||
@ -25,14 +32,39 @@ public class ProfileEditorHistory
|
||||
Redo = ReactiveCommand.Create(ExecuteRedo, CanRedo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the profile configuration the history relates to.
|
||||
/// </summary>
|
||||
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();
|
||||
|
||||
/// <summary>
|
||||
/// Gets an observable sequence containing a boolean value indicating whether history can be redone.
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reactive command that can be executed to undo history.
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
/// <summary>
|
||||
/// Clears the history.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
ClearRedo();
|
||||
@ -40,6 +72,10 @@ public class ProfileEditorHistory
|
||||
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)
|
||||
{
|
||||
command.Execute();
|
||||
@ -52,8 +88,10 @@ public class ProfileEditorHistory
|
||||
private void ClearRedo()
|
||||
{
|
||||
foreach (IProfileEditorCommand profileEditorCommand in _redoCommands)
|
||||
{
|
||||
if (profileEditorCommand is IDisposable disposable)
|
||||
disposable.Dispose();
|
||||
}
|
||||
|
||||
_redoCommands.Clear();
|
||||
}
|
||||
@ -61,8 +99,10 @@ public class ProfileEditorHistory
|
||||
private void ClearUndo()
|
||||
{
|
||||
foreach (IProfileEditorCommand profileEditorCommand in _undoCommands)
|
||||
{
|
||||
if (profileEditorCommand is IDisposable disposable)
|
||||
disposable.Dispose();
|
||||
}
|
||||
|
||||
_undoCommands.Clear();
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared.Controls;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Artemis.UI.Shared.Services.ProfileEditor.Commands;
|
||||
using Avalonia.Threading;
|
||||
@ -79,7 +80,7 @@ public abstract class PropertyInputViewModel<T> : PropertyInputViewModel
|
||||
/// <summary>
|
||||
/// Gets or boolean indicating whether the current input is being previewed, the value won't be applied until
|
||||
/// <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" />
|
||||
/// </para>
|
||||
/// </summary>
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
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: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>
|
||||
<Border Padding="50">
|
||||
<StackPanel Spacing="5">
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
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>
|
||||
<Border Padding="20" Width="200">
|
||||
<StackPanel Spacing="5">
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core"
|
||||
xmlns:fluent="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
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>
|
||||
<VisualBrush x:Key="LightCheckerboardBrush" TileMode="Tile" Stretch="Uniform" DestinationRect="3,0,10,10">
|
||||
<VisualBrush.Visual>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
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>
|
||||
<Border Padding="20" Width="200">
|
||||
<StackPanel Spacing="5">
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using SharpVk;
|
||||
using SharpVk.Khronos;
|
||||
using SkiaSharp;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
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"
|
||||
x:Class="Artemis.UI.DefaultTypes.PropertyInput.ColorGradientPropertyInputView"
|
||||
x:DataType="propertyInput:ColorGradientPropertyInputViewModel">
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Artemis.UI.Shared.GradientPicker;
|
||||
using Artemis.UI.Shared.Controls.GradientPicker;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
|
||||
@ -51,19 +51,12 @@
|
||||
<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">
|
||||
<TabControl Items="{CompiledBinding Tabs}">
|
||||
<TabControl Items="{CompiledBinding Tabs}" Padding="12">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{CompiledBinding DisplayName}" />
|
||||
</DataTemplate>
|
||||
</TabControl.ItemTemplate>
|
||||
<TabControl.ContentTemplate>
|
||||
<DataTemplate>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<ContentControl Content="{Binding}" Margin="0 12" />
|
||||
</ScrollViewer>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</TabControl>
|
||||
</Border>
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Device.DeviceInfoTabView">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<Grid RowDefinitions="Auto,*" ColumnDefinitions="*,*" Margin="-5">
|
||||
<!-- First row -->
|
||||
<Border Classes="card" Grid.Column="0" Grid.Row="0" Margin="5">
|
||||
@ -82,4 +83,6 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
</UserControl>
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -2,7 +2,27 @@
|
||||
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: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"
|
||||
x:Class="Artemis.UI.Screens.Device.DeviceLedsTabView">
|
||||
Welcome to Avalonia!
|
||||
x:Class="Artemis.UI.Screens.Device.DeviceLedsTabView"
|
||||
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>
|
||||
@ -39,44 +39,4 @@ namespace Artemis.UI.Screens.Device
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,7 @@
|
||||
<device:DevicePropertiesTabViewModel />
|
||||
</Design.DataContext>
|
||||
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<!-- Body -->
|
||||
<Grid RowDefinitions="*,Auto">
|
||||
<StackPanel Grid.Row="0">
|
||||
@ -196,4 +197,5 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -7,12 +7,8 @@
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Device.InputMappingsTabView"
|
||||
x:DataType="device:InputMappingsTabViewModel">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
|
||||
<Grid RowDefinitions="Auto,Auto,*">
|
||||
<StackPanel Grid.Row="0">
|
||||
<TextBlock Classes="h4">
|
||||
Introduction
|
||||
@ -71,4 +67,5 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@ -7,8 +7,8 @@
|
||||
xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties;assembly=Artemis.UI.Shared"
|
||||
xmlns:workshop="clr-namespace:Artemis.UI.Screens.Workshop"
|
||||
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:gradientPicker="clr-namespace:Artemis.UI.Shared.Controls.GradientPicker;assembly=Artemis.UI.Shared"
|
||||
mc:Ignorable="d" d:DesignWidth="800"
|
||||
x:Class="Artemis.UI.Screens.Workshop.WorkshopView"
|
||||
x:DataType="workshop:WorkshopViewModel">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user