mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Meta - Fixed a whole bunch of warnings
This commit is contained in:
parent
503cc89cd5
commit
1c15fbe983
@ -256,6 +256,18 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler? RenderPropertiesUpdated;
|
public event EventHandler? RenderPropertiesUpdated;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void Activate()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override void Deactivate()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace Artemis.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a list containing a tuple for each value in the enum type
|
/// Creates a list containing a tuple for each value in the enum type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="t">The enum type to create value descriptions for</param>
|
/// <typeparam name="T">The enum type to create value descriptions for</typeparam>
|
||||||
/// <returns>A list containing a value-description tuple for each value in the enum type</returns>
|
/// <returns>A list containing a value-description tuple for each value in the enum type</returns>
|
||||||
public static List<(T, string)> GetAllValuesAndDescriptions<T>() where T : struct, Enum
|
public static List<(T, string)> GetAllValuesAndDescriptions<T>() where T : struct, Enum
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,7 +45,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
if (_list.Count > 0)
|
if (_list.Count > 0)
|
||||||
{
|
{
|
||||||
T value = _list.First.Value;
|
T value = _list.First!.Value;
|
||||||
_list.RemoveFirst();
|
_list.RemoveFirst();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
if (_list.Count > 0)
|
if (_list.Count > 0)
|
||||||
{
|
{
|
||||||
T value = _list.First.Value;
|
T value = _list.First!.Value;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -92,7 +92,7 @@ namespace Artemis.Core
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
if (this.Count > 0)
|
if (this.Count > 0)
|
||||||
{
|
{
|
||||||
result = Peek().Equals(value);
|
result = Peek()!.Equals(value);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,16 +4,26 @@
|
|||||||
<name>Artemis.UI.Shared</name>
|
<name>Artemis.UI.Shared</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
|
<member name="T:Artemis.UI.Shared.Controls.ArtemisIcon">
|
||||||
|
<summary>
|
||||||
|
Represents a control that can display an arbitrary kind of icon.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Controls.ArtemisIcon.#ctor">
|
||||||
|
<summary>
|
||||||
|
Creates a new instance of the <see cref="T:Artemis.UI.Shared.Controls.ArtemisIcon" /> class.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="F:Artemis.UI.Shared.Controls.ArtemisIcon.IconProperty">
|
<member name="F:Artemis.UI.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" />
|
||||||
to an SVG
|
pointing to an SVG
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:Artemis.UI.Shared.Controls.ArtemisIcon.Icon">
|
<member name="P:Artemis.UI.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" />
|
||||||
to an SVG
|
pointing to an SVG
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:Artemis.UI.Shared.Controls.DeviceVisualizer">
|
<member name="T:Artemis.UI.Shared.Controls.DeviceVisualizer">
|
||||||
@ -80,11 +90,21 @@
|
|||||||
<member name="M:Artemis.UI.Shared.Controls.DeviceVisualizer.MeasureOverride(Avalonia.Size)">
|
<member name="M:Artemis.UI.Shared.Controls.DeviceVisualizer.MeasureOverride(Avalonia.Size)">
|
||||||
<inheritdoc />
|
<inheritdoc />
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Artemis.UI.Shared.Controls.EnumComboBox">
|
||||||
|
<summary>
|
||||||
|
Represents a combobox that can display the values of an enum.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="F:Artemis.UI.Shared.Controls.EnumComboBox.ValueProperty">
|
<member name="F:Artemis.UI.Shared.Controls.EnumComboBox.ValueProperty">
|
||||||
<summary>
|
<summary>
|
||||||
Gets or sets the currently selected value
|
Gets or sets the currently selected value
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Controls.EnumComboBox.#ctor">
|
||||||
|
<summary>
|
||||||
|
Creates a new instance of the <see cref="T:Artemis.UI.Shared.Controls.EnumComboBox" /> class.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:Artemis.UI.Shared.Controls.EnumComboBox.Value">
|
<member name="P:Artemis.UI.Shared.Controls.EnumComboBox.Value">
|
||||||
<summary>
|
<summary>
|
||||||
Gets or sets the currently selected value
|
Gets or sets the currently selected value
|
||||||
@ -126,6 +146,16 @@
|
|||||||
<member name="M:Artemis.UI.Shared.Controls.NoInputTextBox.OnKeyUp(Avalonia.Input.KeyEventArgs)">
|
<member name="M:Artemis.UI.Shared.Controls.NoInputTextBox.OnKeyUp(Avalonia.Input.KeyEventArgs)">
|
||||||
<inheritdoc />
|
<inheritdoc />
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Artemis.UI.Shared.Controls.ProfileConfigurationIcon">
|
||||||
|
<summary>
|
||||||
|
Represents a control that can display the icon of a specific <see cref="T:Artemis.Core.ProfileConfiguration"/>.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Controls.ProfileConfigurationIcon.#ctor">
|
||||||
|
<summary>
|
||||||
|
Creates a new instance of the <see cref="T:Artemis.UI.Shared.Controls.ProfileConfigurationIcon" /> class.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="F:Artemis.UI.Shared.Controls.ProfileConfigurationIcon.ConfigurationIconProperty">
|
<member name="F:Artemis.UI.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
|
||||||
@ -158,7 +188,17 @@
|
|||||||
</member>
|
</member>
|
||||||
<member name="F:Artemis.UI.Shared.Controls.SelectionRectangle.InputElementProperty">
|
<member name="F:Artemis.UI.Shared.Controls.SelectionRectangle.InputElementProperty">
|
||||||
<summary>
|
<summary>
|
||||||
Defines the <see cref="M:Artemis.UI.Shared.Controls.SelectionRectangle.get_InputElement" /> property.
|
Defines the <see cref="P:Artemis.UI.Shared.Controls.SelectionRectangle.InputElement" /> property.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdatedProperty">
|
||||||
|
<summary>
|
||||||
|
Defines the <see cref="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdated" /> property.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinishedProperty">
|
||||||
|
<summary>
|
||||||
|
Defines the <see cref="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinished" /> property.
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.#ctor">
|
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.#ctor">
|
||||||
@ -179,6 +219,24 @@
|
|||||||
Gets or sets the width of the control's border
|
Gets or sets the width of the control's border
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:Artemis.UI.Shared.Controls.SelectionRectangle.InputElement">
|
||||||
|
<summary>
|
||||||
|
Gets or sets the element that captures input for the selection rectangle.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdated">
|
||||||
|
<summary>
|
||||||
|
Gets or sets the command to execute when the selection has been updated.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinished">
|
||||||
|
<summary>
|
||||||
|
Gets or sets the command to execute when the selection has finished.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.Render(Avalonia.Media.DrawingContext)">
|
||||||
|
<inheritdoc />
|
||||||
|
</member>
|
||||||
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.OnAttachedToVisualTree(Avalonia.VisualTreeAttachmentEventArgs)">
|
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.OnAttachedToVisualTree(Avalonia.VisualTreeAttachmentEventArgs)">
|
||||||
<inheritdoc />
|
<inheritdoc />
|
||||||
</member>
|
</member>
|
||||||
@ -781,10 +839,96 @@
|
|||||||
Adds the provided extension to the filter
|
Adds the provided extension to the filter
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:Artemis.UI.Shared.Services.Builders.NotificationBuilder">
|
||||||
|
<summary>
|
||||||
|
Represents a builder that can be used to create notifications.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.#ctor(Avalonia.Controls.Window)">
|
||||||
|
<summary>
|
||||||
|
Creates a new instance of the <see cref="T:Artemis.UI.Shared.Services.Builders.NotificationBuilder" /> class.
|
||||||
|
</summary>
|
||||||
|
<param name="parent">The parent window that will host the notification.</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.WithTitle(System.String)">
|
||||||
|
<summary>
|
||||||
|
Changes the title of the notification.
|
||||||
|
</summary>
|
||||||
|
<param name="title">The new title.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.WithMessage(System.String)">
|
||||||
|
<summary>
|
||||||
|
Changes the message of the notification.
|
||||||
|
</summary>
|
||||||
|
<param name="content">The new message.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.WithTimeout(System.TimeSpan)">
|
||||||
|
<summary>
|
||||||
|
Changes the timeout of the notification after which it disappears automatically.
|
||||||
|
</summary>
|
||||||
|
<param name="timeout">The timeout of the notification after which it disappears automatically.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.WithVerticalPosition(Avalonia.Layout.VerticalAlignment)">
|
||||||
|
<summary>
|
||||||
|
Changes the vertical position of the notification inside the parent window.
|
||||||
|
</summary>
|
||||||
|
<param name="position">The vertical position of the notification inside the parent window.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.WithHorizontalPosition(Avalonia.Layout.HorizontalAlignment)">
|
||||||
|
<summary>
|
||||||
|
Changes the horizontal position of the notification inside the parent window.
|
||||||
|
</summary>
|
||||||
|
<param name="position">The horizontal position of the notification inside the parent window.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.WithSeverity(Artemis.UI.Shared.Services.Builders.NotificationSeverity)">
|
||||||
|
<summary>
|
||||||
|
Changes the severity (color) of the notification.
|
||||||
|
</summary>
|
||||||
|
<param name="severity">The severity (color) of the notification.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
</member>
|
||||||
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.HavingButton(System.Action{Artemis.UI.Shared.Services.Builders.NotificationButtonBuilder})">
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.HavingButton(System.Action{Artemis.UI.Shared.Services.Builders.NotificationButtonBuilder})">
|
||||||
<summary>
|
<summary>
|
||||||
Add a filter to the dialog
|
Changes the action button of the dialog.
|
||||||
</summary>
|
</summary>
|
||||||
|
<param name="configure">An action to configure the button.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationBuilder.Show">
|
||||||
|
<summary>
|
||||||
|
Shows the notification.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:Artemis.UI.Shared.Services.Builders.NotificationButtonBuilder">
|
||||||
|
<summary>
|
||||||
|
Represents a builder that can be used to create buttons inside notifications.
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationButtonBuilder.WithText(System.String)">
|
||||||
|
<summary>
|
||||||
|
Changes text message of the button.
|
||||||
|
</summary>
|
||||||
|
<param name="text">The new text.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the button.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationButtonBuilder.WithAction(System.Action)">
|
||||||
|
<summary>
|
||||||
|
Changes action that is called when the button is clicked.
|
||||||
|
</summary>
|
||||||
|
<param name="action">The action to call when the button is clicked.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the button.</returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:Artemis.UI.Shared.Services.Builders.NotificationButtonBuilder.WithCommand(System.Windows.Input.ICommand)">
|
||||||
|
<summary>
|
||||||
|
Changes command that is called when the button is clicked.
|
||||||
|
</summary>
|
||||||
|
<param name="command">The command to call when the button is clicked.</param>
|
||||||
|
<returns>The notification builder that can be used to further build the button.</returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:Artemis.UI.Shared.Services.Builders.OpenFileDialogBuilder">
|
<member name="T:Artemis.UI.Shared.Services.Builders.OpenFileDialogBuilder">
|
||||||
<summary>
|
<summary>
|
||||||
|
|||||||
@ -128,6 +128,15 @@
|
|||||||
"resolved": "1.0.0-prerelease1",
|
"resolved": "1.0.0-prerelease1",
|
||||||
"contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ=="
|
"contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ=="
|
||||||
},
|
},
|
||||||
|
"RGB.NET.Layout": {
|
||||||
|
"type": "Direct",
|
||||||
|
"requested": "[1.0.0-prerelease1, )",
|
||||||
|
"resolved": "1.0.0-prerelease1",
|
||||||
|
"contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"RGB.NET.Core": "1.0.0-prerelease1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"type": "Direct",
|
"type": "Direct",
|
||||||
"requested": "[2.10.0, )",
|
"requested": "[2.10.0, )",
|
||||||
@ -401,14 +410,6 @@
|
|||||||
"Microsoft.Extensions.ObjectPool": "5.0.9"
|
"Microsoft.Extensions.ObjectPool": "5.0.9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"RGB.NET.Layout": {
|
|
||||||
"type": "Transitive",
|
|
||||||
"resolved": "1.0.0-prerelease1",
|
|
||||||
"contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==",
|
|
||||||
"dependencies": {
|
|
||||||
"RGB.NET.Core": "1.0.0-prerelease1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"RGB.NET.Presets": {
|
"RGB.NET.Presets": {
|
||||||
"type": "Transitive",
|
"type": "Transitive",
|
||||||
"resolved": "1.0.0-prerelease1",
|
"resolved": "1.0.0-prerelease1",
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace Artemis.UI.Linux
|
|||||||
Core.Utilities.RestartRequested += UtilitiesOnRestartRequested;
|
Core.Utilities.RestartRequested += UtilitiesOnRestartRequested;
|
||||||
|
|
||||||
// On OS shutdown dispose the kernel just so device providers get a chance to clean up
|
// On OS shutdown dispose the kernel just so device providers get a chance to clean up
|
||||||
if (Application.Current.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
||||||
{
|
{
|
||||||
controlledApplicationLifetime.Exit += (_, _) =>
|
controlledApplicationLifetime.Exit += (_, _) =>
|
||||||
{
|
{
|
||||||
@ -118,7 +118,7 @@ namespace Artemis.UI.Linux
|
|||||||
|
|
||||||
//TODO: start new instance with correct arguments
|
//TODO: start new instance with correct arguments
|
||||||
|
|
||||||
if (Application.Current.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
||||||
Dispatcher.UIThread.Post(() => controlledApplicationLifetime.Shutdown());
|
Dispatcher.UIThread.Post(() => controlledApplicationLifetime.Shutdown());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ namespace Artemis.UI.Linux
|
|||||||
{
|
{
|
||||||
RunForcedShutdownIfEnabled();
|
RunForcedShutdownIfEnabled();
|
||||||
|
|
||||||
if (Application.Current.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime controlledApplicationLifetime)
|
||||||
Dispatcher.UIThread.Post(() => controlledApplicationLifetime.Shutdown());
|
Dispatcher.UIThread.Post(() => controlledApplicationLifetime.Shutdown());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AvaloniaResource Include="Assets\**" />
|
<AvaloniaResource Include="Assets\**" />
|
||||||
|
|||||||
@ -1,6 +1,9 @@
|
|||||||
|
// ReSharper disable UnusedMember.Global
|
||||||
|
|
||||||
|
#pragma warning disable CS0649
|
||||||
namespace Artemis.UI.Linux.Providers.Input
|
namespace Artemis.UI.Linux.Providers.Input
|
||||||
{
|
{
|
||||||
//https://www.kernel.org/doc/Documentation/input/input.txt
|
// https://www.kernel.org/doc/Documentation/input/input.txt
|
||||||
internal readonly struct LinuxInputEventArgs
|
internal readonly struct LinuxInputEventArgs
|
||||||
{
|
{
|
||||||
internal readonly long TimeSeconds;
|
internal readonly long TimeSeconds;
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AvaloniaResource Include="Assets\**" />
|
<AvaloniaResource Include="Assets\**" />
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<StartupObject />
|
<StartupObject />
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DocumentationFile>C:\Repos\Artemis\src\Artemis.UI.Avalonia.Shared\Artemis.UI.Avalonia.Shared.xml</DocumentationFile>
|
<DocumentationFile>C:\Repos\Artemis\src\Artemis.UI.Avalonia.Shared\Artemis.UI.Avalonia.Shared.xml</DocumentationFile>
|
||||||
|
|||||||
@ -10,34 +10,25 @@ using Material.Icons.Avalonia;
|
|||||||
|
|
||||||
namespace Artemis.UI.Shared.Controls
|
namespace Artemis.UI.Shared.Controls
|
||||||
{
|
{
|
||||||
public partial class ArtemisIcon : UserControl
|
/// <summary>
|
||||||
|
/// Represents a control that can display an arbitrary kind of icon.
|
||||||
|
/// </summary>
|
||||||
|
public class ArtemisIcon : UserControl
|
||||||
{
|
{
|
||||||
#region Properties
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the currently displayed icon as either a <see cref="MaterialIconKind" /> or an <see cref="Uri" /> pointing
|
/// Creates a new instance of the <see cref="ArtemisIcon" /> class.
|
||||||
/// to an SVG
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<object?> IconProperty =
|
public ArtemisIcon()
|
||||||
AvaloniaProperty.Register<ArtemisIcon, object?>(nameof(Icon), notifying: IconChanging);
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the currently displayed icon as either a <see cref="MaterialIconKind" /> or an <see cref="Uri" /> pointing
|
|
||||||
/// to an SVG
|
|
||||||
/// </summary>
|
|
||||||
public object? Icon
|
|
||||||
{
|
{
|
||||||
get => GetValue(IconProperty);
|
InitializeComponent();
|
||||||
set => SetValue(IconProperty, value);
|
DetachedFromLogicalTree += OnDetachedFromLogicalTree;
|
||||||
|
LayoutUpdated += OnLayoutUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private static void IconChanging(IAvaloniaObject sender, bool before)
|
private static void IconChanging(IAvaloniaObject sender, bool before)
|
||||||
{
|
{
|
||||||
if (before)
|
if (before)
|
||||||
((ArtemisIcon)sender).Update();
|
((ArtemisIcon) sender).Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@ -46,39 +37,37 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
{
|
{
|
||||||
// First look for an enum value instead of a string
|
// First look for an enum value instead of a string
|
||||||
if (Icon is MaterialIconKind materialIcon)
|
if (Icon is MaterialIconKind materialIcon)
|
||||||
Content = new MaterialIcon { Kind = materialIcon, Width = Bounds.Width, Height = Bounds.Height };
|
{
|
||||||
|
Content = new MaterialIcon {Kind = materialIcon, Width = Bounds.Width, Height = Bounds.Height};
|
||||||
|
}
|
||||||
// If it's a string there are several options
|
// If it's a string there are several options
|
||||||
else if (Icon is string iconString)
|
else if (Icon is string iconString)
|
||||||
{
|
{
|
||||||
// An enum defined as a string
|
// An enum defined as a string
|
||||||
if (Enum.TryParse(iconString, true, out MaterialIconKind parsedIcon))
|
if (Enum.TryParse(iconString, true, out MaterialIconKind parsedIcon))
|
||||||
Content = new MaterialIcon { Kind = parsedIcon, Width = Bounds.Width, Height = Bounds.Height };
|
{
|
||||||
|
Content = new MaterialIcon {Kind = parsedIcon, Width = Bounds.Width, Height = Bounds.Height};
|
||||||
|
}
|
||||||
// An URI pointing to an SVG
|
// An URI pointing to an SVG
|
||||||
else if (iconString.EndsWith(".svg"))
|
else if (iconString.EndsWith(".svg"))
|
||||||
{
|
{
|
||||||
SvgSource source = new();
|
SvgSource source = new();
|
||||||
source.Load(iconString);
|
source.Load(iconString);
|
||||||
Content = new SvgImage { Source = source };
|
Content = new SvgImage {Source = source};
|
||||||
}
|
}
|
||||||
// An URI pointing to a different kind of image
|
// An URI pointing to a different kind of image
|
||||||
else
|
else
|
||||||
Content = new Image { Source = new Bitmap(iconString), Width = Bounds.Width, Height = Bounds.Height };
|
{
|
||||||
|
Content = new Image {Source = new Bitmap(iconString), Width = Bounds.Width, Height = Bounds.Height};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Content = new MaterialIcon { Kind = MaterialIconKind.QuestionMark, Width = Bounds.Width, Height = Bounds.Height };
|
Content = new MaterialIcon {Kind = MaterialIconKind.QuestionMark, Width = Bounds.Width, Height = Bounds.Height};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArtemisIcon()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
DetachedFromLogicalTree += OnDetachedFromLogicalTree;
|
|
||||||
LayoutUpdated += OnLayoutUpdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnLayoutUpdated(object? sender, EventArgs e)
|
private void OnLayoutUpdated(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Content is Control contentControl)
|
if (Content is Control contentControl)
|
||||||
@ -100,5 +89,27 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the currently displayed icon as either a <see cref="MaterialIconKind" /> or an <see cref="Uri" />
|
||||||
|
/// pointing to an SVG
|
||||||
|
/// </summary>
|
||||||
|
public static readonly StyledProperty<object?> IconProperty =
|
||||||
|
AvaloniaProperty.Register<ArtemisIcon, object?>(nameof(Icon), notifying: IconChanging);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the currently displayed icon as either a <see cref="MaterialIconKind" /> or an <see cref="Uri" />
|
||||||
|
/// pointing to an SVG
|
||||||
|
/// </summary>
|
||||||
|
public object? Icon
|
||||||
|
{
|
||||||
|
get => GetValue(IconProperty);
|
||||||
|
set => SetValue(IconProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,14 +10,29 @@ using Avalonia.Markup.Xaml;
|
|||||||
|
|
||||||
namespace Artemis.UI.Shared.Controls
|
namespace Artemis.UI.Shared.Controls
|
||||||
{
|
{
|
||||||
public partial class EnumComboBox : UserControl
|
/// <summary>
|
||||||
|
/// Represents a combobox that can display the values of an enum.
|
||||||
|
/// </summary>
|
||||||
|
public class EnumComboBox : UserControl
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the currently selected value
|
/// Gets or sets the currently selected value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<object?> ValueProperty =
|
public static readonly StyledProperty<object?> ValueProperty =
|
||||||
AvaloniaProperty.Register<EnumComboBox, object?>(nameof(Value), defaultBindingMode: BindingMode.TwoWay, notifying: ValueChanged);
|
AvaloniaProperty.Register<EnumComboBox, object?>(nameof(Value), defaultBindingMode: BindingMode.TwoWay, notifying: ValueChanged);
|
||||||
|
|
||||||
|
private readonly ObservableCollection<(Enum, string)> _currentValues = new();
|
||||||
|
|
||||||
|
private ComboBox? _enumComboBox;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="EnumComboBox" /> class.
|
||||||
|
/// </summary>
|
||||||
|
public EnumComboBox()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the currently selected value
|
/// Gets or sets the currently selected value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -27,9 +42,6 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
set => SetValue(ValueProperty, value);
|
set => SetValue(ValueProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ComboBox? _enumComboBox;
|
|
||||||
private readonly ObservableCollection<(Enum, string)> _currentValues = new();
|
|
||||||
|
|
||||||
private static void ValueChanged(IAvaloniaObject sender, bool before)
|
private static void ValueChanged(IAvaloniaObject sender, bool before)
|
||||||
{
|
{
|
||||||
if (sender is EnumComboBox enumCombo && !before)
|
if (sender is EnumComboBox enumCombo && !before)
|
||||||
@ -39,11 +51,6 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumComboBox()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
@ -54,7 +61,7 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
if (_enumComboBox == null)
|
if (_enumComboBox == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var (enumValue, _) = _currentValues[_enumComboBox.SelectedIndex];
|
(Enum enumValue, _) = _currentValues[_enumComboBox.SelectedIndex];
|
||||||
if (!Equals(Value, enumValue))
|
if (!Equals(Value, enumValue))
|
||||||
Value = enumValue;
|
Value = enumValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
private void DisplayTextBoxOnKeyUp(object? sender, KeyEventArgs e)
|
private void DisplayTextBoxOnKeyUp(object? sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyModifiers == KeyModifiers.None)
|
if (e.KeyModifiers == KeyModifiers.None)
|
||||||
FocusManager.Instance.Focus(null);
|
FocusManager.Instance?.Focus(null);
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
@ -79,7 +79,7 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
private void Button_OnClick(object? sender, RoutedEventArgs e)
|
private void Button_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Hotkey = null;
|
Hotkey = null;
|
||||||
FocusManager.Instance.Focus(null);
|
FocusManager.Instance?.Focus(null);
|
||||||
|
|
||||||
UpdateDisplayTextBox();
|
UpdateDisplayTextBox();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,8 +12,14 @@ using Material.Icons.Avalonia;
|
|||||||
|
|
||||||
namespace Artemis.UI.Shared.Controls
|
namespace Artemis.UI.Shared.Controls
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a control that can display the icon of a specific <see cref="ProfileConfiguration"/>.
|
||||||
|
/// </summary>
|
||||||
public class ProfileConfigurationIcon : UserControl
|
public class ProfileConfigurationIcon : UserControl
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="ProfileConfigurationIcon" /> class.
|
||||||
|
/// </summary>
|
||||||
public ProfileConfigurationIcon()
|
public ProfileConfigurationIcon()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|||||||
@ -19,14 +19,14 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<IBrush> BackgroundProperty =
|
public static readonly StyledProperty<IBrush> BackgroundProperty =
|
||||||
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(Background),
|
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(Background),
|
||||||
new SolidColorBrush(AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>().CustomAccentColor ?? Colors.Transparent, 0.25));
|
new SolidColorBrush(AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>()?.CustomAccentColor ?? Colors.Transparent, 0.25));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="BorderBrush" /> property.
|
/// Defines the <see cref="BorderBrush" /> property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<IBrush> BorderBrushProperty =
|
public static readonly StyledProperty<IBrush> BorderBrushProperty =
|
||||||
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(BorderBrush),
|
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(BorderBrush),
|
||||||
new SolidColorBrush(AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>().CustomAccentColor ?? Colors.Transparent));
|
new SolidColorBrush(AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>()?.CustomAccentColor ?? Colors.Transparent));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="BorderBrush" /> property.
|
/// Defines the <see cref="BorderBrush" /> property.
|
||||||
@ -35,14 +35,20 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
AvaloniaProperty.Register<SelectionRectangle, double>(nameof(BorderThickness), 1);
|
AvaloniaProperty.Register<SelectionRectangle, double>(nameof(BorderThickness), 1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defines the <see cref="get_InputElement" /> property.
|
/// Defines the <see cref="InputElement" /> property.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly StyledProperty<IControl?> InputElementProperty =
|
public static readonly StyledProperty<IControl?> InputElementProperty =
|
||||||
AvaloniaProperty.Register<SelectionRectangle, IControl?>(nameof(InputElement), notifying: OnInputElementChanged);
|
AvaloniaProperty.Register<SelectionRectangle, IControl?>(nameof(InputElement), notifying: OnInputElementChanged);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="SelectionUpdated" /> property.
|
||||||
|
/// </summary>
|
||||||
public static readonly StyledProperty<ICommand?> SelectionUpdatedProperty
|
public static readonly StyledProperty<ICommand?> SelectionUpdatedProperty
|
||||||
= AvaloniaProperty.Register<SelectionRectangle, ICommand?>(nameof(SelectionUpdated));
|
= AvaloniaProperty.Register<SelectionRectangle, ICommand?>(nameof(SelectionUpdated));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines the <see cref="SelectionFinished" /> property.
|
||||||
|
/// </summary>
|
||||||
public static readonly StyledProperty<ICommand?> SelectionFinishedProperty
|
public static readonly StyledProperty<ICommand?> SelectionFinishedProperty
|
||||||
= AvaloniaProperty.Register<SelectionRectangle, ICommand?>(nameof(SelectionUpdated));
|
= AvaloniaProperty.Register<SelectionRectangle, ICommand?>(nameof(SelectionUpdated));
|
||||||
|
|
||||||
@ -84,18 +90,27 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
set => SetValue(BorderThicknessProperty, value);
|
set => SetValue(BorderThicknessProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the element that captures input for the selection rectangle.
|
||||||
|
/// </summary>
|
||||||
public IControl? InputElement
|
public IControl? InputElement
|
||||||
{
|
{
|
||||||
get => GetValue(InputElementProperty);
|
get => GetValue(InputElementProperty);
|
||||||
set => SetValue(InputElementProperty, value);
|
set => SetValue(InputElementProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the command to execute when the selection has been updated.
|
||||||
|
/// </summary>
|
||||||
public ICommand? SelectionUpdated
|
public ICommand? SelectionUpdated
|
||||||
{
|
{
|
||||||
get => GetValue(SelectionUpdatedProperty);
|
get => GetValue(SelectionUpdatedProperty);
|
||||||
set => SetValue(SelectionUpdatedProperty, value);
|
set => SetValue(SelectionUpdatedProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the command to execute when the selection has finished.
|
||||||
|
/// </summary>
|
||||||
public ICommand? SelectionFinished
|
public ICommand? SelectionFinished
|
||||||
{
|
{
|
||||||
get => GetValue(SelectionFinishedProperty);
|
get => GetValue(SelectionFinishedProperty);
|
||||||
@ -168,6 +183,7 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
|
|
||||||
#region Overrides of Visual
|
#region Overrides of Visual
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
public override void Render(DrawingContext drawingContext)
|
public override void Render(DrawingContext drawingContext)
|
||||||
{
|
{
|
||||||
if (_displayRect != null)
|
if (_displayRect != null)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Layout;
|
using Avalonia.Layout;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
@ -9,12 +10,19 @@ using Button = Avalonia.Controls.Button;
|
|||||||
|
|
||||||
namespace Artemis.UI.Shared.Services.Builders
|
namespace Artemis.UI.Shared.Services.Builders
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a builder that can be used to create notifications.
|
||||||
|
/// </summary>
|
||||||
public class NotificationBuilder
|
public class NotificationBuilder
|
||||||
{
|
{
|
||||||
private readonly InfoBar _infoBar;
|
private readonly InfoBar _infoBar;
|
||||||
private readonly Window _parent;
|
private readonly Window _parent;
|
||||||
private TimeSpan _timeout = TimeSpan.FromSeconds(5);
|
private TimeSpan _timeout = TimeSpan.FromSeconds(5);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of the <see cref="NotificationBuilder" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parent">The parent window that will host the notification.</param>
|
||||||
public NotificationBuilder(Window parent)
|
public NotificationBuilder(Window parent)
|
||||||
{
|
{
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
@ -26,30 +34,55 @@ namespace Artemis.UI.Shared.Services.Builders
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the title of the notification.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title">The new title.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
public NotificationBuilder WithTitle(string? title)
|
public NotificationBuilder WithTitle(string? title)
|
||||||
{
|
{
|
||||||
_infoBar.Title = title;
|
_infoBar.Title = title;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the message of the notification.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content">The new message.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
public NotificationBuilder WithMessage(string? content)
|
public NotificationBuilder WithMessage(string? content)
|
||||||
{
|
{
|
||||||
_infoBar.Message = content;
|
_infoBar.Message = content;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the timeout of the notification after which it disappears automatically.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timeout">The timeout of the notification after which it disappears automatically.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
public NotificationBuilder WithTimeout(TimeSpan timeout)
|
public NotificationBuilder WithTimeout(TimeSpan timeout)
|
||||||
{
|
{
|
||||||
_timeout = timeout;
|
_timeout = timeout;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the vertical position of the notification inside the parent window.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">The vertical position of the notification inside the parent window.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
public NotificationBuilder WithVerticalPosition(VerticalAlignment position)
|
public NotificationBuilder WithVerticalPosition(VerticalAlignment position)
|
||||||
{
|
{
|
||||||
_infoBar.VerticalAlignment = position;
|
_infoBar.VerticalAlignment = position;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the horizontal position of the notification inside the parent window.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="position">The horizontal position of the notification inside the parent window.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
public NotificationBuilder WithHorizontalPosition(HorizontalAlignment position)
|
public NotificationBuilder WithHorizontalPosition(HorizontalAlignment position)
|
||||||
{
|
{
|
||||||
_infoBar.HorizontalAlignment = position;
|
_infoBar.HorizontalAlignment = position;
|
||||||
@ -57,8 +90,21 @@ namespace Artemis.UI.Shared.Services.Builders
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add a filter to the dialog
|
/// Changes the severity (color) of the notification.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="severity">The severity (color) of the notification.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
|
public NotificationBuilder WithSeverity(NotificationSeverity severity)
|
||||||
|
{
|
||||||
|
_infoBar.Severity = (InfoBarSeverity) severity;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes the action button of the dialog.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="configure">An action to configure the button.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the notification.</returns>
|
||||||
public NotificationBuilder HavingButton(Action<NotificationButtonBuilder> configure)
|
public NotificationBuilder HavingButton(Action<NotificationButtonBuilder> configure)
|
||||||
{
|
{
|
||||||
NotificationButtonBuilder builder = new();
|
NotificationButtonBuilder builder = new();
|
||||||
@ -68,12 +114,9 @@ namespace Artemis.UI.Shared.Services.Builders
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NotificationBuilder WithSeverity(NotificationSeverity severity)
|
/// <summary>
|
||||||
{
|
/// Shows the notification.
|
||||||
_infoBar.Severity = (InfoBarSeverity) severity;
|
/// </summary>
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Show()
|
public void Show()
|
||||||
{
|
{
|
||||||
if (_parent.Content is not Panel panel)
|
if (_parent.Content is not Panel panel)
|
||||||
@ -103,28 +146,57 @@ namespace Artemis.UI.Shared.Services.Builders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a builder that can be used to create buttons inside notifications.
|
||||||
|
/// </summary>
|
||||||
public class NotificationButtonBuilder
|
public class NotificationButtonBuilder
|
||||||
{
|
{
|
||||||
private string _text = "Text";
|
|
||||||
private Action? _action;
|
private Action? _action;
|
||||||
|
private ICommand? _command;
|
||||||
|
private string _text = "Text";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes text message of the button.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="text">The new text.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the button.</returns>
|
||||||
public NotificationButtonBuilder WithText(string text)
|
public NotificationButtonBuilder WithText(string text)
|
||||||
{
|
{
|
||||||
_text = text;
|
_text = text;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changes action that is called when the button is clicked.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="action">The action to call when the button is clicked.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the button.</returns>
|
||||||
public NotificationButtonBuilder WithAction(Action action)
|
public NotificationButtonBuilder WithAction(Action action)
|
||||||
{
|
{
|
||||||
|
_command = null;
|
||||||
_action = action;
|
_action = action;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IControl Build()
|
/// <summary>
|
||||||
|
/// Changes command that is called when the button is clicked.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command">The command to call when the button is clicked.</param>
|
||||||
|
/// <returns>The notification builder that can be used to further build the button.</returns>
|
||||||
|
public NotificationButtonBuilder WithCommand(ICommand command)
|
||||||
{
|
{
|
||||||
return _action != null
|
_action = null;
|
||||||
? new Button {Content = _text, Command = ReactiveCommand.Create(() => _action())}
|
_command = command;
|
||||||
: new Button {Content = _text};
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal IControl Build()
|
||||||
|
{
|
||||||
|
if (_action != null)
|
||||||
|
return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action())};
|
||||||
|
if (_command != null)
|
||||||
|
return new Button {Content = _text, Command = _command};
|
||||||
|
return new Button {Content = _text};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.UI.Windows.Utilities
|
|||||||
{
|
{
|
||||||
public static class ProcessUtilities
|
public static class ProcessUtilities
|
||||||
{
|
{
|
||||||
public static Process RunAsDesktopUser(string fileName, string arguments, bool hideWindow)
|
public static Process? RunAsDesktopUser(string fileName, string arguments, bool hideWindow)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(fileName))
|
if (string.IsNullOrWhiteSpace(fileName))
|
||||||
throw new ArgumentException("Value cannot be null or whitespace.", nameof(fileName));
|
throw new ArgumentException("Value cannot be null or whitespace.", nameof(fileName));
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<OutputPath>bin\</OutputPath>
|
<OutputPath>bin\</OutputPath>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AvaloniaResource Include="Assets\**" />
|
<AvaloniaResource Include="Assets\**" />
|
||||||
|
|||||||
@ -46,14 +46,14 @@ namespace Artemis.UI.Screens.ProfileEditor.Commands
|
|||||||
{
|
{
|
||||||
_isRemoved = true;
|
_isRemoved = true;
|
||||||
_target.RemoveChild(_subject);
|
_target.RemoveChild(_subject);
|
||||||
_target.Deactivate();
|
_subject.Deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Undo()
|
public void Undo()
|
||||||
{
|
{
|
||||||
_isRemoved = false;
|
_isRemoved = false;
|
||||||
_target.Activate();
|
_subject.Activate();
|
||||||
_target.AddChild(_subject, _index);
|
_target.AddChild(_subject, _index);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user