This project is read-only.

Configure the Application (Version V4)

Let’s take a look at the advanced features of the AD4.AppDesigner, eg. Application Description Language Generation 4. According to our sample, we want to make the refresh time of the current time sending that is implemented in the component “TimerClock” configurable. The AD4.AppDesigner offers a built-in mechanism to process configure parameters at each step if you want to do so. To use this feature you have to add a reference to the “AD4.AppDesigner.Core” library at the component that wants to use these features. In our example add the reference to the “AD4.TimeClockLibrary” project that contains the “TimerClock” functional unit. The unit has to implement the interface “AD4.AppDesigner.Core.Interfaces.IConfigure”. This interface specifies a method called “Configure” with argument of type “System.Object” to process any type of arguments. The following code snippet shows the adapted implementation of “TimerClock” if the refresh time is given by this argument:

using System;
using System.Threading;
using AD4.AppDesigner.Core.Interfaces;
namespace AD4.TimerClockLibrary
   public class TimerClock: IConfigure
      private Timer _Timer;
      private int _Period;
      public void DefaultInputPin()
         _Timer = new Timer(new TimerCallback(TimeElapsed), null, 0, _Period);
      private void TimeElapsed(object state)
      public event Action<DateTime> DefaultOutputPin;
      public void Configure(object arg)
         _Period = (int)arg;

But how does one “send” the refresh time to this component? The answer is: it’s the first parameter of the “BuildApp” method implemented by the “AppBuilder” class. Therefore, we simply have to customize the call of the method in “Application_Startup”. The following code snippet shows the adapted line if a refresh time of 1.000 milliseconds should be used:

tAppBuilder.BuildApp(1000, null);

The meaning of the second parameter of “BuildApp” is explained in the next chapter …

In general, the customization is finished now. However, the call of method “Configure” is identified by the AD4.AppDesigner while creating the source code by reflection. Therefore, first rebuild your application to update the assemblies. Then press the “Code” button to generate the extended source code. Now the extended application is ready to use.

This is a restriction of the AD4.AppDesigner! It’s planned for a later version of the AD4.AppDesigner to avoid this restriction. If possible, this document will be updated!
You can download the solution here: AD4.TutorialSamples

Update (2014-08-13): Design attributes extended:
Update (2015-03-30): This page is obsolete. You find the current version of the tutorial as offline documentation included in downloads...

Previous: Flows & Pins (Version V3)
Next: Initialize the Application (Version V5)

Last edited Mar 30, 2015 at 9:18 AM by InneHo, version 11