mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Node script window - Always update the script while open
This commit is contained in:
parent
0e3d26e89e
commit
5d6208f852
@ -3,6 +3,7 @@ using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
@ -12,6 +13,7 @@ using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.NodeEditor;
|
||||
using Artemis.UI.Shared.Services.NodeEditor.Commands;
|
||||
using Avalonia;
|
||||
using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using DynamicData.List;
|
||||
using ReactiveUI;
|
||||
@ -54,6 +56,13 @@ public class NodeScriptWindowViewModel : DialogViewModelBase<bool>
|
||||
CreateNode = ReactiveCommand.Create<NodeData>(ExecuteCreateNode);
|
||||
Export = ReactiveCommand.CreateFromTask(ExecuteExport);
|
||||
Import = ReactiveCommand.CreateFromTask(ExecuteImport);
|
||||
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(25.0 / 1000), DispatcherPriority.Normal, Update);
|
||||
updateTimer.Start();
|
||||
Disposable.Create(() => updateTimer.Stop()).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
public NodeScript NodeScript { get; }
|
||||
@ -119,4 +128,9 @@ public class NodeScriptWindowViewModel : DialogViewModelBase<bool>
|
||||
await Task.Delay(200);
|
||||
NodeScriptViewModel.RequestAutoFit();
|
||||
}
|
||||
|
||||
private void Update(object? sender, EventArgs e)
|
||||
{
|
||||
NodeScript.Run();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user