-
Notifications
You must be signed in to change notification settings - Fork 12
Basic concept
The concept of GAPP is easy: All functionality is provided within plugins. The Core is just a data container that triggers events when things changed. Each plugin is independent at design time. If a plugin wants functionality of another plugin, it should use reflection. The plugin cannot assume that another plugin is available.
Design constraints:
To simplify the design, almost all events from Core should be triggered on UI context. This means that changing data, like adding geocaches, should prevent triggering events in case it is done in a separate thread. To prevent data (e.q. Framework.Data.Geocache or Framework.Data.GeocacheCollection) from triggering events when changing data, you can use the BeginUpdate(). After finishing modifying the data, you can call EndUpdate(). The EndUpdate will trigger an event if data has changed. Therefore the EndUpdate() should always be called within the UI context.
Utils contains helpers for this:
GlobalcachingApplication.Utils.FrameworkDataUpdater. The constructor calls the BeginUpdate() on all collection of Core and the Dispose will call the EndUpdate()
example:
using (Utils.FrameworkDataUpdater upd = new Utils.FrameworkDataUpdater(Core))
{
//change data and that might be in a separate tthread
}
Data storage:
Data that is not part of Core should be stored by the plugin itself. There are many examples of that. You can use XML or Sqlite e.g. The data should generally be stored in the core.PluginDataPath