Demo Program Description
Two demo interfaces available
Ibplone=Interface ['{e4c1c5fa-c598-4834-9111-26b52634068d}'] functionAdd (A,b:integer): Integer; functionSub (A,b:integer): Integer; End; Idllone=Interface ['{0434de04-07c9-4623-9009-cf7892768431}'] functionGetString:string; procedureSetString (ConstStr:string); End;
This demonstrates the main form calling interface Ibplone, calling the DLL and the form in BPL
The DLL form calls the Ibplone interface and the Idllone interface, and the BPL form calls the Idllone interface
Where Ibplone is created with an interface factory, Idllone is created with a single-instance factory, so the DLL form calls the interface idllone with the BPL form call Interface Idllone is the same instance
Development steps
Main program
Replace the forms in the project file with Utangramframework, while adding the core package Tangram_core to the runtime
If you created the main program through the IDE Wizard, these two steps are ready
Module
A module must refer to the framework package to be called by the framework, define a tmoudle subclass and a getmoduleclass export function, and create a module with a wizard that will automatically create
Type Tusermodule=Class (tmodule)Private PublicConstructor Create;Override; destructor Destroy; Override; procedureInit;Override; procedureFinalOverride; procedureNotify (Flags:integer; Intf:iinterface);Override; class procedureRegistermodule (Reg:iregistry);Override; class procedureUnregistermodule (Reg:iregistry);Override; End;initialization //Module sub-class registrationRegistermoduleclass (tusermodule);Finalization
// Module Export function exports Installmodule, uninstallmodule, getmoduleclass;
Then create the interface definition file in the package, we usually put the open interface into a common directory, and add Delphi search path, so that other projects can also refer to
Unitbploneintf;{$WEAKPACKAGEUNIT on}InterfacetypeIbplone=Interface ['{e4c1c5fa-c598-4834-9111-26b52634068d}'] functionAdd (A,b:integer): Integer; functionSub (A,b:integer): Integer; End;ImplementationEnd.
Using a wizard to create an interface implementation unit, an interface implementation unit creates an interface implementation class, an interface instance creation function, and a class factory
//interface Implementation ClassType Tbplone=class (Tinterfacedobject,ibplone)//Suppose your interface is called IXXX (hereinafter) Private protected {ixxx} //Add your interface method here, then press Ctrl+shift+c to implement your interface ... functionAdd (A,b:integer): Integer; functionSub (A,b:integer): Integer; public End;Implementation//Interface instance creation functionprocedureCreate_bplone ( outaninstance:iinterface);beginaninstance:=tbplone.create;End;//class factory RegistrationvarFactory:tobject;initializationFactory:=tintffactory.create (Ibplone, @Create_BplOne);FinalizationFactory.free;
This completes the module's writing, followed by the interface call
procedureTfrmmain.button1click (sender:tobject);varIntf:ibplone;beginintf:=sysservice asIbplone; Edit3.text:=IntToStr (intf. ADD (Strtoint (Edit1.text), Strtoint (Edit2.text)));End;procedureTfrmbplone.button3click (sender:tobject);varIntf:idllone;beginintf:=sysservice asIdllone; Edit5.text:=intf. GetString;End;
The framework uses a unified interface call, a defined class factory interface, can be called by Sysservice as Ixxx Unified Way to invoke
Before running the program, put the compiled framework core package TANGRAM_CORE.BPL and the Framework Configuration tool ConfigTool.exe into the program directory.
By default, the framework uses a module from an XML file to automatically load the modules, and a well-done module is installed through the Framework Configuration tool.
Video Tutorial Address:
erpsystem Development tutorial Http://pan.baidu.com/s/1kT7Rb3D
erpsystem Development Tutorial http://pan.baidu.com/s/11xN5s
Framework Source Code Http://pan.baidu.com/s/1jGIc2Su
Demo Source Code Http://pan.baidu.com/s/1bnyEafH
Contact qq:1330009208 (Verification information please fill in Erpsystem)
Erpsystem Development Tutorial-Demo program development process