Search website

AutoCount Accounting Plug-in (version 2)

(Build with AutoCount Accounting version 1.8.7)

(For AutoCount Accounting version 1.8.8, please download the project converter to help update your plug-in to be compatible with the stated version)


An AutoCount Plug-in is a .Net class library (.dll) which must implement the IPlugIn interface and one or more IMenuItem interface or MenuItemAttribute.

Before creating an AutoCount Plug-in, you must remember 2 important information. The first is that every AutoCount plug-in is required to have a Global Unique Identifier (GUID) assigned to it to uniquely identify them. The second is that to always create your Plug-in in the AnyCPU Solution Platform. The reason for this is to allow your plug-in to work in either the 32-bit or 64 bit versions of the AutoCount Accounting that your users are running.

Implement class inherited from BasePlugIn (IPlugIn)

  1. Create a new class inherited from BCE.AutoCount.PlugIn.BasePlugIn.
  2. Create a default parameterless constructor, and call the inherited constructor by providing 3 parameters:
    • GUID: a Global Unique Identifier of this plug-in, you should not change this value from time to time.
    • Name: A display name of this plug-in.
    • Version: Version of the plug-in.
    • And for the following information, while optional, it is better to set them as well inside the constructor:
      • SetManufacturer
      • SetManufacturerUrl
      • SetCopyright
      • SetSalesPhone
      • SetSupportPhone
      • SetMinimumAccountingVersionRequired
  3. If your plug-in implements your own license control, then you have to call the SetIsFreeLicense(false) method inside the constructor.
  4. However, if you wish to implement a license control similar to AutoCount, then you will have to:
    • Call SetSupportLicenseKey(true)
    • Override public virtual void UpdateLicenseStatus(LicenseStatusArgs e).
    • Override public virtual void TestLicenseKey(LicenseStatusArgs e, string licenseKey) to provide your own license logic.
  5. If you want your plug-in to be controlled under AutoCount license control, then you just follow the below:
    • Call SetSupportLicenseKey(true)
    • Override public virtual void UpdateLicenseStatus(LicenseStatusArgs e).
  6. Override BeforeLoad method.
    • This method is a replacement for the previous Initializer static method marked with PlugInsInitializerAttribute.
    • This method will be called before a plug-in is going to be loaded. Return false if you don’t want to load the plug-in into the system.
  7. If you wish, you can override AfterUnload to unload the logic previously called in the BeforeLoad
    • This method will be called after a plug-in is unloaded from the system.
  8. Please see the SamplePlugIn class code sample below on how to implement the class.
  9. If you are migrating from version 1 Plug-in code, you should copy the code in the PlugInsInitializerAttribute method to BeforeLoad method.
SamplePlugIn Code Snippet
  1. public class SamplePlugIn : BCE.AutoCount.PlugIn.BasePlugIn
  2. {
  3.     public SamplePlugIn() : base(new Guid(“97814787-C48A-4E8E-8549-994850141A09″), “AutoCount Accounting Sample Plug-Ins”, “1.0″)
  4.     {
  5.         SetManufacturer(“Auto Count Sdn. Bhd.”);
  6.         SetManufacturerUrl(“”);
  7.         SetCopyright(“Copyright 2014 © Auto Count Sdn. Bhd.”);
  8.         SetSalesPhone(“1-800-88-7766″);
  9.         SetSupportPhone(“+60-3-3324-2148″);
  10.         SetMinimumAccountingVersionRequired(“1.8.2″);
  11.     }
  12.     public override bool BeforeLoad(BCE.AutoCount.PlugIn.BeforeLoadArgs e)
  13.     {
  14.         if (!IsValidDatabase(e.DBSetting))
  15.         {
  16.             if (!BCE.Application.AppMessage.ShowConfirmMessage(“Do you want to install Sample plug-in to this database?”))
  17.                 return false;
  18.             if (!BCE.Application.AppMessage.ShowConfirmMessage(“Do you really want to install Sample plug-in to this database?\n(Note: Once installed, you cannot remove it.)”))
  19.                 return false;
  20.             return RunEmbeddedDatabaseSchema(e.DBSetting, “SamplePlugIns.SQL”);
  21.         }
  22.         e.MainMenuCaption = “Sample PlugIns”;
  23.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  24. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_PLUGINS, null, BCE.AutoCount.Controller.ModuleOptions.None));
  25.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  26. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE, SamplePlugInsStringId.AC_PLUGINS, BCE.AutoCount.Controller.ModuleOptions.None));
  27.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  28. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER, SamplePlugInsStringId.AC_SAMPLE, BCE.AutoCount.Controller.ModuleOptions.None));
  29.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  30. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_SHOW, SamplePlugInsStringId.AC_SAMPLE_DEALER, BCE.AutoCount.Controller.ModuleOptions.None));
  31.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  32. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_OPEN, SamplePlugInsStringId.AC_SAMPLE_DEALER, BCE.AutoCount.Controller.ModuleOptions.None));
  33.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  34. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING, SamplePlugInsStringId.AC_SAMPLE_DEALER, BCE.AutoCount.Controller.ModuleOptions.None));
  35.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  36. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_SHOW, SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING, BCE.AutoCount.Controller.ModuleOptions.None));
  37.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  38. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_OPEN, SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING, BCE.AutoCount.Controller.ModuleOptions.None));
  39.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  40. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_PREVIEW, SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING, BCE.AutoCount.Controller.ModuleOptions.None));
  41.         BCE.AutoCount.AccessRight.AccessRightMap.AddAccessRightRecord(
  42. new BCE.AutoCount.AccessRight.AccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_PRINT, SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING, BCE.AutoCount.Controller.ModuleOptions.None));
  43.         BCE.AutoCount.Report.AutoCountReport.RegisterReportType(
  44. FormDealerListing.ReportType, typeof(DealerListingReportTypeHandler));
  45.         return true;
  46.     }
  47.     public override void AfterUnload(BCE.AutoCount.PlugIn.BaseArgs e)
  48.     {
  49.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_PLUGINS.ToString());
  50.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE.ToString());
  51.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER.ToString());
  52.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_SHOW.ToString());
  53.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_OPEN.ToString());
  54.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING.ToString());
  55.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_SHOW.ToString());
  56.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_OPEN.ToString());
  57.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_PREVIEW.ToString());
  58.             BCE.AutoCount.AccessRight.AccessRightMap.RemoveAccessRightRecord(SamplePlugInsStringId.AC_SAMPLE_DEALER_LISTING_PRINT.ToString());
  59.     }
  60. }


Implements MenuItemAttribute or IMenuItem.

Implementing MenuItemAttribute:

  1. Mark any form class with MenuItemAttribute to make it appear in the AutoCount menu.
  2. MenuItemAttribute is formerly named PlugInsEntryPointAttribute. As such due to the removal of the PlugInsEntryPointAttribute constructor (below), you can replace it with the MenuItemAttribute constructor (below) with the rest of the parameters can be provided as named parameters

Please see the code sample below which implements the MenuItemAttribute.

MenuItemAttribute Code Snippet
  1. [BCE.AutoCount.PlugIn.MenuItem(“Dealer Maintenance”, 1, false, “AC_SAMPLE_DEALER_SHOW”, “AC_SAMPLE_DEALER_OPEN”)]
  2. [BCE.Application.SingleInstanceThreadForm]
  3. public class FormDealerMaint : System.Windows.Forms.Form


Implementing IMenuItem:

  1. Create a new class inherited from BCE.AutoCount.PlugIn.BaseMenuItem.
  2. Create a default parameterless constructor, and call the inherited constructor by providing the 5 parameters below:
    • menuCaption: The caption of the menu item.
    • menuOrder: The order of the menu item.
    • beginNewGroup: Set true if you want to add a line before this menu item.
    • visibleAccessRight: The access right string used to control the visibility of the menu item.
    • openAccessRight: The access right string used to control whether you can run the menu function.
  3. Moreover, you can set the following value by overriding.
    • myParentMenuCaption: If you want to make this menu a submenu of another menu, then set its parent menu caption.
    • myParentMenuOrder: The order of the parent menu item.
    • myParentBeginNewGroup: Set true if you want to add a line before this parent menu item.
    • myIcon: Set a 40×40 image object to represent the icon of this function. This icon will be used in future versions to allow the plug-in to be place on the Favorite main screen.
  4. Override the public virtual void MenuItemClick(BCE.Application.ISimpleThreadFormLauncher threadFormLauncher, DBSetting setting) method.
    • Provide your own menu function by implementing the logic in this method.

Please see the following code sample which shows how to implement a new class with BaseMenuItem

BaseMenuItem Code Snippet
  1. public class FormDealerMaintMenu3 : BCE.AutoCount.PlugIn.BaseMenuItem
  2. {
  3.     public FormDealerMaintMenu3() : base(“Dealer Maintenance 3″, 1, false, “AC_SAMPLE_DEALER_SHOW”, “AC_SAMPLE_DEALER_OPEN”)
  4.     {
  5.     }
  6.     public override void MenuItemClick(BCE.Application.ISimpleThreadFormLauncher threadFormLauncher, DBSetting setting)
  7.     {
  8.         threadFormLauncher.LaunchAppForm(typeof(FormDealerMaint).AssemblyQualifiedName);
  9.     }
  10. }

Notice that the MenuItemClick method called the threadFormLauncher.LaunchAppForm method to launch the dealer maintenance form in thread form mode.

Although we are still supporting MenuItemAttribute, in the future it may not be supported any longer as this method cannot support the myIcon parameter of the menu function.


In version 2, after one has finished creating an AutoCount plug-in, he has to use a tool called AutoCount Plug-in Package Builder (version 1.0.2) to create an AutoCount Plug-in Package (.app). This AutoCount Plug-in Package (.app) will be loaded and installed into the current account book by the built-in function in AutoCount Accounting. When AutoCount Accounting is started, it will check and extract the content of the plug-in into the current user space, and then load the plug-in assembly before doing the necessary bindings and running the plug-in.