CasewareDocs

Custom attribute

As an SDK developer you can specify which form is the main/starting form when creating a Visual Studio "SmartAnalyzerMacroDialog" type containing multiple forms. This attribute is available as of IDEA version 10.1.

When an SDK developer creates a new Visual Studio 2013/2015 C# project of type "SmartAnalyzerMacroDialog":

  1. The code line using.Audicon.SmartAnalyzer.Common.Types is added to the "DialogMainForms.cs" file.
  2. A commented attribute is added in the same file for the class _DialogMainForm:

    //[DefaultForm] // uncomment this line for apps requiring IDEA 10.1 or higher.

    public partial class _DialogMainForm: Form

This [DefaultForm] custom attribute marks a form as being the main/start form in a C# project containing multiple forms.

If the loader finds a form with this attribute this form will be considered the main form of the dialog.

If it fails to load the whole dialog binary code will fail.

If such a form is not found, the old algorithm will be used (load forms by their type order in the assembly).

[DefaultForm] attributes have to be extended to allow the SDK developer to specify a list of known properties and their values.

An example that is needed is a property called ShowInReportIfDisabled. By default this is True(1), but the dialog developer can set it to False(0). This property will tell the loader to set the ShowInReport property of the disabled controls to False automatically if needed. The list of known properties may grow in the course of time, but the implementation has to be fixed for SDK so that the dialog could also be loaded in the lower versions of IDEA that do not know the new known properties.

Example of attribute usage:

[DefaultForm]

[DefaultForm(Parameters = "param1=1;param2=blabla;param3=1500")]

[DefaultForm(Separator = "\r\n", Parameters = @"param1=1;param2=blabla;param3=1500")]

The separator between the name and value is always ";", but it can be changed using the Separator property.