Hi DarkTimes. Here is my code:
MainLoop Code:
void mainLoop()
{
testlfs.LFS testfls = new LFS();
float pitch = 0;
while (true)
{
if (!testfls.IsConnected)
testfls.Connect();
else
pitch = testfls.pitch;
System.Threading.Thread.Sleep(20);
}
}
LFS Class:
class LFS
{
private OutSim outsim;
public bool IsConnected = false;
public float pitch = 0;
public LFS()
{
outsim = new OutSim(1);
outsim.PacketReceived += new EventHandler<OutSimEventArgs>(outsim_PacketReceived);
}
public void Connect()
{
if (!outsim.IsConnected)
{
outsim.Connect("127.0.0.1", 29999);
this.IsConnected = true;
}
}
void outsim_PacketReceived(object sender, OutSimEventArgs e)
{
this.pitch = e.Pitch;
}
}
If I run this program with LFS, all works perfect. But if I start this program without LFS and, I run LFS, it never launch outsim_PacketReceived, I must stop and run the program. I need do this automatically.
Thanks for your response!