// Main program file generated by Zinc Designer.

#include "eventwn2.hpp"
#include "event2.inc"

int ZafApplication::Main(void)
{
	// Ensure main() is linked properly.
	LinkMain();

	// Establish access to external objects and data.
	ZafStorage *storage = new ZafStorage(ZAF_ITEXT("event2.znc"), ZAF_FILE_READ);
	if (storage->Error())
	{
		zafErrorSystem->ReportError(ZAF_NULLP(ZafWindowObject),
			ZAF_ITEXT("Error"), ZAF_DIALOG_OK,
			ZAF_ITEXT("event2.znc could not be found."));
		delete storage;
		return (-1);
	}

	zafObjectPersistence = new UserPersist(storage);

	// Display initial windows.
	zafWindowManager->Add(new EventWindow(ZAF_ITEXT("EventWindow"), *zafObjectPersistence));


	// Get the user input.
	Control();

	delete zafObjectPersistence;
	zafObjectPersistence = ZAF_NULLP(ZafObjectPersistence);
	delete storage;

	// Return success.
	return (0);
}
