Hi guys, I have 2 classes, first one is my ScreenHost and second one is ViewController.
ScreenHost creates a ViewController and adds some Graph objects to it, then it waits until DataArived event raised and it calls Render() method on ViewController.
The problem is ViewController doesn't show anything, it just shows a white screen while the Render() method runs properly! But when I call Render() right after constructor it draws my shapes.
Here's my code (summerized):
////////////////////////////////////////////
/////// ScreenHost.SetScreen()
////////////////////////////////////////////
public void SetScreen()
{
vc = new ViewController(800, 600, Rows, Cols);
...
// If i call vc.Render() it works
}
////////////////////////////////////////////
/////// ScreenHost.DataArived event
////////////////////////////////////////////
void DataArived ()
{
// it runs Render() but doesn't show anything except a white screen (Render clears screen with black color)
vc.Render();
}
////////////////////////////////////////////
/////// ScreenHost.DataArived event
////////////////////////////////////////////
public void Render()
{
// it clears screen with black color
renderWindow.Clear(Color.Black);
}