I have read, that it could be possible to fuse UnityEngine
with Winforms
, so that is what I am trying to do. I am trying to use a sine wave to control the flickering between colors on a button in Winform
. However I am getting a SecurityException
which I do not konw how to solve.
private void DisplayMessage(string messge)
{
int numVal;
//SPELL.Text += messge + Environment.NewLine;
numVal = Convert.ToInt32(messge);
udpSock1.Close();
if (numVal == 83)
{
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
//Application.Idle += new EventHandler(Application_Idle);
//Application.Run(form1);
BCI1 form1 = new BCI1();
//Application.Run(form1);
form1.ShowDialog();
//stopwatch.Start();
SPELL.Text = SPELL.Text + form1.LET;
udpSock1 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
udpSock1.Bind(new IPEndPoint(IPAddress.Any, 8050));
buffer = new byte[1024];
newClientEP = new IPEndPoint(IPAddress.Any, 0);
udpSock1.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref newClientEP, DoReceiveFrom, udpSock1);
//udpSock.Disconnect(true);
//udpSock.Connect(new IPEndPoint(IPAddress.Any, 8050));
}
Here I open the new form, and the form hen diplays som characters, which can chosen, hereafter the form closes agian, and you return to the main, form 1.