Skip to content

Commit

Permalink
Fixed Console Actions to allow multiple consoles running. Placed them…
Browse files Browse the repository at this point in the history
… in Thread.
  • Loading branch information
sakakun committed Nov 24, 2024
1 parent 8826685 commit 17f51f7
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 8 deletions.
5 changes: 4 additions & 1 deletion Classes/consoles/NoVNCClient.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Classes/consoles/NoVNCClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ public partial class NoVncClient : Form
private readonly MachineData machine;
private WebView2 webView;

public NoVncClient(MachineData machine, string remote = "novcs")
public NoVncClient(MachineData machine)
{
this.machine = machine;
InitializeComponent();

}
public void RequestWebConnection(string remote = "novcs")
{
CenterToScreen();
InitializeWebView(remote);
}

private async void InitializeWebView(string remoteType)
{
if (remoteType == "novnc")
Expand Down
125 changes: 125 additions & 0 deletions Classes/consoles/NoVNCClient.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,129 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAAAAAAAEAIADpGwAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAEAAAABAAgGAAAAXHKoZgAAAAFv
ck5UAc+id5oAABujSURBVHja7V0LkFXVlT3N/yPQKEUDE5ufqSg/UwEBQSmjyGcQUVA0mZiAKEycSQQB
zThTpYBCrEyJIwhUmDgh/DJxSkA+WlMEhcZUENqGMvJ3In+lIZFusRu7gdknbz+rvdV03/Pefe/dvc9a
VasqFZvud/dee797z11nH2MAAAAAAAAAAAAAAAAAAA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eWYaB7EOyxfdexXm5ibjXwDIMZBDW
1rnEyLT4TvQgP98lfiwwP0sMLMOxhz3q+gUj7/1zGfEnJr4W36gx2sibulTN2mqOMosvuhl5R1p9RnzM
o+JPYoyR58v4gDUGxBi3EvcIeua3h3fkeZqrMYIeB/awtgABuNHE/5jrPxk4zixuMfGfKrSZNQUIgrXP
zieej5mYLpqEMaYnUvQV7Lv212K4dnOeNVSAFMmE3Tpr96iXxERQdozXdCNrY0+20Jr4uEn4IOKQqxLW
TmOkRj4KTWJ3Wq4m1thVfntibT+kol70NYn37rnasn2KtVKIVOhCHovLHp2VrdVnK+I1xOEGE2dc0IzX
R9ab7A0XOcHa6Gv8XZT1Ag14QcdO17HW1IoMPON/ZBJbYa2ltwVCnjJacvNcyo8GUW8trmANzGZNNEDI
/UI74ijiiyYxK/4T4374pRWldfHZ10SvmoSbrzu+RSJv2t8yiUM+l5vEGPLyFBpCFee4iHM+ijUAAKYV
sTdxHHGmSUyLteft2V1sO0xie2gxi+dNFuIs4kMmsXe8Pb5BsgI7cqwjcQhxAvE54kriW5ybYs7VDs7d
Os7lTM5tb841ANSLJnwLb1eorzGJ1fuW/DyPYo9XU2jGucnnXLXm3DVBeAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAyDD+H4On36whjyRHAAAAAElFTkSuQmCC
</value>
</data>
</root>
43 changes: 38 additions & 5 deletions Panels/MainPanel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
Expand Down Expand Up @@ -167,9 +168,9 @@ private void GenerateMachineTile(MachineData machineData)
powerContextMenu.Items.AddRange(new ToolStripItem[] { pMenuItem1, pMenuItem2, pMenuItem3, pMenuItem4, pMenuItem5, pMenuItem6, pMenuItem7 });

// Remote Set Click Actions
rMenuItem1.Click += (_, _) => WebClient(machineData, "novnc");
rMenuItem2.Click += (_, _) => SpiceClient(machineData.Vmid);
rMenuItem3.Click += (_, _) => WebClient(machineData, "xtermjs");
rMenuItem1.Click += (_, _) => WebThread(machineData, "novnc");
rMenuItem2.Click += (_, _) => SpiceThread(machineData.Vmid);
rMenuItem3.Click += (_, _) => WebThread(machineData, "xtermjs");

// Power Set Click Actions
pMenuItem1.Click += (_, _) => PowerRequest("start", machineData);
Expand Down Expand Up @@ -319,6 +320,36 @@ private void OpenSpiceProxyPanel(object sender, EventArgs e)
Program._Panels.Add("SpiceProxyPanel", panelSpiceProxy);
panelSpiceProxy.Show();
}
// New Thread for Consoles
private static void InvokeOnUIThread(Action action)
{
if (Application.OpenForms.Count > 0)
{
var form = Application.OpenForms[0]; // Get the main form
if (form.InvokeRequired)
{
form.Invoke(action);
}
else
{
action();
}
}
else
{
throw new InvalidOperationException("No open forms available.");
}
}

private static void SpiceThread(int vmid)
{
InvokeOnUIThread(() => SpiceClient(vmid));
}

private static void WebThread(MachineData machineData, string remoteType)
{
InvokeOnUIThread(() => WebClient(machineData, remoteType));
}

// Opening Consoles
private static void SpiceClient(int vmid)
Expand All @@ -330,7 +361,9 @@ private static void WebClient(MachineData machineData, string remoteType)
{
// ReSharper disable once UnusedVariable
// ReSharper disable once ObjectCreationAsStatement
new NoVncClient(machineData, remoteType);
}
var webClient = new NoVncClient(machineData);
webClient.RequestWebConnection(remoteType);

}

}

0 comments on commit 17f51f7

Please sign in to comment.