i have used this sample [GitHub SignalR Samples]
https://github.com/nthdeveloper/SignalRSamples
it use a winforms as a signalR server
it use two clients winforms and a javascript
it append the client message in the textbox
private void SimpleHub_MessageReceived(string senderClientId, string message)
{
//One of the clients sent a message, log it
this.BeginInvoke(new Action(() =>
{
string clientName = _clients.FirstOrDefault(x => x.Id == senderClientId)?.Name;
writeToLog($"{clientName}:{message}");
}));
}
i need to open a form based on message
private void SimpleHub_MessageReceived(string senderClientId, string message)
{
//One of the clients sent a message, log it
this.BeginInvoke(new Action(() =>
{
string clientName = _clients.FirstOrDefault(x => x.Id == senderClientId)?.Name;
switch (message)
{
case "form1":
Form1 frm = new Form1();
frm.Show();
break;
case "form2":
Form2 frm = new Form();
frm.Show();
break;
default:
// code block
break;
}
}));
}
i have tried that code the form opens and stays loading i can not interact with it what is missing