- Create ScriptConsoleControl for displaying script output and interactive input - Create PowerShellConsoleWindow to host the script console - Wire up ScriptDebugger events to console control for real-time output - Add debug scripts menu to GameActionBarView (visible when EnableScriptDebugging=true) - Scripts run via SDK's ScriptClient and stay interactive after completion - Fix MediaImporter.ExistsAsync to check database record instead of file existence - Remove Iciclecreek.Avalonia.Terminal dependency, revert Avalonia to 11.2.3
49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using System;
|
|
|
|
namespace LANCommander.Launcher.Avalonia.ViewModels;
|
|
|
|
public partial class PowerShellConsoleViewModel : ViewModelBase
|
|
{
|
|
[ObservableProperty]
|
|
private string _title = "PowerShell Console";
|
|
|
|
[ObservableProperty]
|
|
private string? _statusMessage;
|
|
|
|
[ObservableProperty]
|
|
private bool _canClose = true;
|
|
|
|
[ObservableProperty]
|
|
private string _workingDirectory = string.Empty;
|
|
|
|
public Action? CloseAction { get; set; }
|
|
|
|
public PowerShellConsoleViewModel()
|
|
{
|
|
}
|
|
|
|
public PowerShellConsoleViewModel(string title, string workingDirectory)
|
|
{
|
|
Title = title;
|
|
WorkingDirectory = workingDirectory;
|
|
}
|
|
|
|
[RelayCommand]
|
|
private void Close()
|
|
{
|
|
CloseAction?.Invoke();
|
|
}
|
|
|
|
public void OnScriptCompleted()
|
|
{
|
|
StatusMessage = "Script execution complete. Terminal is interactive.";
|
|
}
|
|
|
|
public void OnSessionEnded()
|
|
{
|
|
StatusMessage = "Session ended.";
|
|
CanClose = true;
|
|
}
|
|
}
|