Exercise 1: Build My First Plug-In: Difference between revisions

From AutoCount Resource Center
Content added Content deleted
mNo edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{NavigateDeveloper|collapsed}}
Objectives: Create a new Plug-in project for AutoCount Accounting 1.8
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.
This exercise is to build an AutoCount Accounting Plug-in Package, and successfully load the Plug-in at AutoCount Accounting Plug-in Manager.
Line 15: Line 14:
2. Name this project as “Tutorial.PRG201”<br /><br /><br /><br />
2. Name this project as “Tutorial.PRG201”<br /><br /><br /><br />
3. After the project is created, go to project “Properties”, select “Application”.<br /><br />
3. After the project is created, go to project “Properties”, select “Application”.<br /><br />
4. Set Target framework to .NET Framework 4.0
4. Set Target framework to '''.NET Framework 4.0'''
* Output type is set to “Class Library”. <br />{{note|AutoCount Accounting 1.8.x, Target framework is .NET Framework 4.0}}<br /><br />
* Output type is set to “Class Library”. <br />{{note|AutoCount Accounting 1.8.x, Target framework is .NET Framework 4.0}}<br /><br />
5. Add below AutoCount Accounting assemblies to project references.<br /><br /><br /><br /><br /><br />
5. Add below AutoCount Accounting assemblies to project references.<br /><br /><br /><br /><br /><br />
Line 66: Line 65:
<br /><br />
<br /><br />
==Step 4 Pack Plug-In in AutoCount Plug-In Package (.app)==
==Step 4 Pack Plug-In in AutoCount Plug-In Package (.app)==
{{DeveloperIDForm}}
[[File:201a.14.PluginBuilder.PNG|right|link=]]
[[File:201a.14.PluginBuilder.PNG|right|link=]]

12. Run '''AutoCount Plug-in Builder'''
12. Run '''AutoCount Plug-in Builder'''


Line 90: Line 91:
To start a new empty project, click [New Project].
To start a new empty project, click [New Project].


17. Click [Build Package] to create “.app file” (AutoCount Plug-in Package).
17. Click [Build Package] to create “.app file” (AutoCount Plug-in Package).
:''Device must be connected to internet, in order to proceed.''
:''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.
:Name the plug-in package as “Tutorial.PRG201.app”, and save it in “packing” folder.
Line 100: Line 101:
==Step 5 Load AutoCount Plug-In Package into AutoCount Accounting==
==Step 5 Load AutoCount Plug-In Package into AutoCount Accounting==
18. Login AutoCount Accounting
18. Login AutoCount Accounting
*Go to Tools | Plug-In Manager
<br/><br />

19. Go to Tools | Plug-In Manager
:''User must be able to access to “Plug-Ins Manager” in Access Rights''
:''User must be able to access to “Plug-Ins Manager” in Access Rights''
:[[File:201a.18.AccessPluginManager.png|link=]]
:[[File:201a.18.AccessPluginManager.png|link=]]
<br/><br />
<br/><br />


20. At Plug-In Manager
19. At Plug-In Manager
* click [Install]
* click [Install]
:Select “Tutorial.PRG201.app” and click [Open].
:Select “Tutorial.PRG201.app” and click [Open].
Line 135: Line 134:
[[Category:Plug-In]]
[[Category:Plug-In]]
[[Category:Programmer Exercise]]
[[Category:Programmer Exercise]]
{{NavigateDeveloper|collapsed}}

Latest revision as of 04:45, 17 January 2018

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.


Step 1 Add References to Plug-In Project

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”.
AutoCount Accounting 1.8.x, Target framework is .NET Framework 4.0


5. Add below AutoCount Accounting assemblies to project references.





Add AutoCount Accounting base assemblies to project's references




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);
}




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)




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

Developer ID is required to build Plug-In for AutoCount Accounting.
Register Developer ID Form

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
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.




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



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

Go to top
Resources For AutoCount Software Developers