Delphi: App initialization - best practices / approach

前端 未结 7 1003
北恋
北恋 2020-12-15 01:47

I run into this regularly, and am just looking for best practice/approach. I have a database / datamodule-containing app, and want to fire up the database/datasets on start

相关标签:
7条回答
  • 2020-12-15 02:51

    There actually isn't such a concept as a "global variable" in Delphi. All variables are scoped to the unit they are in and other units that use that unit.

    Just make the AppInitialized and Initialization stuff as part of your data module. Basically have one class (or datamodule) to rule all your non-UI stuff (kind of like the One-Ring, except not all evil and such.)

    Alternatively you can:

    • Call it from your splash screen.
    • Do it during log in
    • Run the "check for update" in a background thread - don't force them to update right now. Do it kind of like Firefox does.
    0 讨论(0)
提交回复
热议问题