Share via


Startup and Host interaction

When the control first starts, there are several stages that need to complete before it is really ready.

1 Construction.  This occurs when you call GlobeControl's constructor.

2 Initialization on the UI thread.  Some objects can initialize themselves here.  This happens when the control starts receiving windows messages.

3 Initialization on the Render thread.  Other objects need information from the graphics system, which must happen on the render thread to keep DX happy.

4 Start rendering.  The control is now ready to go.

If you start playing with the control before it's done, accessing properties and functions on the various Host objects, you can get bad behavior.  You may get an error, and you may not.  In the current version, there is no validation for this, so you might be fine, or there could be subtle or rare badness.  To get past all of this, you should hook up to the Host.RenderEngine.FirstFrameRendered event and do all of your GlobeControl-related setup there, like adding DataSources and PlugIns, really everything should happen in or after the event.  Properties that derive from Control (the winforms class), such as Height and Width, are ok.

In the next version, we will be validating startup to make sure you don't call most functions until it's ready.  You will be able to access the events on RenderEngine right after construction, but that's all you should do.  There will be a new event, Initialized, to make this process more obvious and logical.

So I encourage everyone to hook up to the FirstFrameRendered event now.  If you're not using it, you may be broken and not realize it.  In the next version, you will definitely be broken.  The FirstFrameRendered event will still be available, and there will not a big difference between it and Initialized, but Initialized will be the best practices way of doing it.

We have tried hard to minimize breaking changes for the next version, and in fact I can't think of any others off the top of my head, but for this we decided it is for the best.

Comments

  • Anonymous
    February 21, 2009
    PingBack from http://www.clickandsolve.com/?p=12697

  • Anonymous
    April 01, 2009
    Next week we'll be releasing a new version of the control. The focus of the release is on perf and bug