mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 11:26:27 +00:00
Device dialog - Added LEDs tab
General - Resolved lots of compile warnings (XML comments)
This commit is contained in:
1 parent
021f17aef4
commit
65837e671a
44 files changed
+1015
-761
No files matched your search
@@ -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();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user