Return Task to keep GC from collecting the consoleOutput
This commit is contained in:
parent
4215cc0cdc
commit
d4e2dbb4b1
@ -5,7 +5,7 @@ namespace VRC_Console;
|
|||||||
public partial class OSCCollar
|
public partial class OSCCollar
|
||||||
{
|
{
|
||||||
private const byte CoordinateSystemSize = 16;
|
private const byte CoordinateSystemSize = 16;
|
||||||
private void SetupConsoleOutput()
|
private Task SetupConsoleOutput()
|
||||||
{
|
{
|
||||||
Layout layout = new Layout().SplitRows(
|
Layout layout = new Layout().SplitRows(
|
||||||
new Layout("Top"),
|
new Layout("Top"),
|
||||||
@ -14,6 +14,8 @@ public partial class OSCCollar
|
|||||||
new Layout("Variable-Values"),
|
new Layout("Variable-Values"),
|
||||||
new Layout("Position")
|
new Layout("Position")
|
||||||
));
|
));
|
||||||
|
if(OperatingSystem.IsWindows())
|
||||||
|
Console.WindowWidth += 20;
|
||||||
Table configTable = new Table();
|
Table configTable = new Table();
|
||||||
configTable.AddColumn("ConVar");
|
configTable.AddColumn("ConVar");
|
||||||
configTable.AddColumn("Value");
|
configTable.AddColumn("Value");
|
||||||
@ -45,7 +47,7 @@ public partial class OSCCollar
|
|||||||
variableTable.AddRow("CalibrationX", "");
|
variableTable.AddRow("CalibrationX", "");
|
||||||
variableTable.AddRow("CalibrationY", "");
|
variableTable.AddRow("CalibrationY", "");
|
||||||
|
|
||||||
AnsiConsole.Live(layout).StartAsync(async displayContext =>
|
return AnsiConsole.Live(layout).StartAsync(async displayContext =>
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,7 @@ public partial class OSCCollar
|
|||||||
private OSCQueryService? OscQueryService { get; set; }
|
private OSCQueryService? OscQueryService { get; set; }
|
||||||
private OscServer _server = null!;
|
private OscServer _server = null!;
|
||||||
private OscClient _client = null!;
|
private OscClient _client = null!;
|
||||||
|
private Task _consoleOutputTask;
|
||||||
|
|
||||||
private float _leashStretch;
|
private float _leashStretch;
|
||||||
private readonly Vector _unitVectorLeash = new(1, 0);
|
private readonly Vector _unitVectorLeash = new(1, 0);
|
||||||
@ -68,7 +69,7 @@ public partial class OSCCollar
|
|||||||
this._portReceive = Extensions.GetAvailableUdpPort();
|
this._portReceive = Extensions.GetAvailableUdpPort();
|
||||||
this.SetupOSCServer();
|
this.SetupOSCServer();
|
||||||
this.SetupOSCQuery();
|
this.SetupOSCQuery();
|
||||||
this.SetupConsoleOutput();
|
this._consoleOutputTask = this.SetupConsoleOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
private OSCCollar(string ip = "127.0.0.1", int portSend = 9000, double radius = 100, double calibrationX = 0,
|
private OSCCollar(string ip = "127.0.0.1", int portSend = 9000, double radius = 100, double calibrationX = 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user