Exercise 1: Build My First Plug-In

From AutoCount Resource Center
Jump to navigation Jump to search
Objectives: Create a new Plug-in project for AutoCount Accounting 1.8
This exercise is to build an AutoCount Accounting Plug-in Package, and successfully load the Plug-in at AutoCount Accounting Plug-in Manager.


Step1.AddRef.png

Step 1 Add References to Plug-In Project

201a.1.NewProject.png

1. Create new “Class Library” project in Microsoft Visual Studio 2015.

  • Visual C# | Windows | Class Library

2. Name this project as “Tutorial.PRG201”



3. After the project is created, go to project “Properties”, select “Application”.

4. Set Target framework to .NET Framework 4.0

  • Output type is set to “Class Library”.
Tips icons.png AutoCount Accounting 1.8.x, Target framework is .NET Framework 4.0


5. Add below AutoCount Accounting assemblies to project references.





201a.3.ProjProp.png
Add AutoCount Accounting base assemblies to project's references


Step2.PluginEntry.png



Step 2 Create Plug-In Entry Point

6. Create a class, and Inherit BCE.AutoCount.PlugIn.BasePlugIn.

Plug-in Entry Point

7. Base class requires 3 parameters at the constructor of derived class.

Parameter 1 - Guid
Guid is a unique identifier for this Plug-in.
Every Plug-in must be assigned with a new Guid.
Parameter 2 - Name
Name of this plug-in.
Given name is displayed in Plug-In Manager.
Parameter 3 - version
The version of this plug-in.


8. Add feature to Prompt message when the plug-in is successfully loaded in AutoCount Accounting.


Insert below code into Plugin class (the class that inherits BasePlugIn)

public override void AfterLoad(BaseArgs e)
{
    BCE.Application.AppMessage.ShowMessage(string.Format("Account book {0}\nhas loaded My First Plugin", e.CompanyName));
    base.AfterLoad(e);
}


Step3.BuildDLL.png



Step 3 Build Project into DLL

9. Run Build Solution to build Tutorial.PRG201.dll

10. Create a folder “packing” in Solution folder.

(Solution folder is where the “.sln” file is stored.)

11. Copy Tutorial.PRG101.dll to “packing” folder

Next step will build the Tutorial.PRG101.dll into AutoCount Plug-in Package (.app)


Step4.PackApp.png



Step 4 Pack Plug-In in AutoCount Plug-In Package (.app)

FillFormIcon.png Developer ID is required to build Plug-In for AutoCount Accounting.
Register Developer ID Form
201a.14.PluginBuilder.PNG

12. Run AutoCount Plug-in Builder

13. Click [Change Developer Id] to enter Developer Id.

In order to verify login Developer ID, the device must be connected to internet.
Login with Developer ID













14. Click [Open Plug-in Assembly File] to load Tutorial.PRG101.dll.

Select the file Tutorial.PRG201.dll in “packing” folder.


15. Description is required, and cannot be emptied.

Enter the features of this plug-in and other information that helps the user to understand the functionalities.

16. Save this as “.appp” (AutoCount Plugin Package Project),

  • click [Save Project]
  • Name this project as “Tutorial.PRG201.appp”, and save it in “packing” folder.
Description is saved in the AutoCount Plugin Package Project (.appp). To retrieve the Description, load the project.
To load existing project, click [Open Project].
To start a new empty project, click [New Project].

17. Click [Build Package] to create “.app file” (AutoCount Plug-in Package).

Device must be connected to internet, in order to proceed.
Name the plug-in package as “Tutorial.PRG201.app”, and save it in “packing” folder.


Step5.LoadApp.png



Step 5 Load AutoCount Plug-In Package into AutoCount Accounting

18. Login AutoCount Accounting

  • Go to Tools | Plug-In Manager
User must be able to access to “Plug-Ins Manager” in Access Rights
201a.18.AccessPluginManager.png



19. At Plug-In Manager

  • click [Install]
Select “Tutorial.PRG201.app” and click [Open].
Below screen shows the plug-in is successfully loaded.



See Also





Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers