public void RunLoop()
{
if (Control == null)
{
throw new ArgumentException("Control cannot be null on loop start");
}
if (frameRate == null)
{
frameRate = new FrameRate();
}
frameRate.Start();
while (NextFrame())
{
frameRate.StartFrame();
if (PreProcess != null)
{
PreProcess(this, new EventArgs());
}
if (ProcessFrame != null)
{
ProcessFrame(this, new EventArgs());
}
if (PostProcess != null)
{
PostProcess(this, new EventArgs());
}
frameRate.EndFrame();
}
frameRate.Stop();
}