EasyIADP Application Component Developer’s Guide

Introduction

Welcome to use EasyIADP Application Component for build your IADP-compliant application. This component is a wrapper of IADP SDK, and encapsulated SDK functions and exposes some classes and events for developers to write application behaviors when SDK behavior occurred (like exception occurred).

This component is also an open-source project, you can download, modify code and re-deploy with your IADP-compliant application. It’s under MIT License.

Content

EasyIADP installer includes the binary code of EasyIADP runtime library, XML file included the component’s helps, and a demo application for EasyIADP application development.

Build application with IadpApplicationContext class

If you want to use EasyIADP library to develop IADP-compliant application, please add EasyIADP library (EasyIADP.ApplicationService.dll) to your .NET project, and add the following code to application startup (e.g. Main() in Program.cs):

[STAThread]
static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);

    IadpApplicationContext context = new IadpApplicationContext(new frmMain());

    context.InitializationFailedEvent += (sender, e) =>
    {
        // TODO: implement application logic for SDK initialization error occurred.
    };

    context.RuntimeErrorEvent += (sender, e) =>
    {
        // TODO: implement application logic for SDK runtime error occurred.
    };

    context.UnauthorizedEvent += (sender, e) =>
    {
        MessageBox.Show(
            "This application's key is invalid or unauthorized, please contact to author of this application.",
            "Application Key is invalid or unauthorized.", MessageBoxButtons.OK, MessageBoxIcon.Error);
        Application.ExitThread();
        Application.Exit();
    };

    context.WarningErrorEvent += (sender, e) =>
    {
        // TODO: implement application logic for SDK warning error occurred.
    };

    context.InitAdpApplication();
    context.Run();
}


(You can find these codes at demo application’s Program.cs file)

When you added, please run your application under Visual Studio Debugger, you can see the Intel AppUp Software Debugger’s output message (with Debug Application ID), and application will run normally.

If you want to change your application ID to production application ID, please replace the application’s constructor to include production application ID like:

IadpApplicationContext context = new IadpApplicationContext(
    new frmMain(), new com.intel.adp.AdpApplicationId(0x01, 0x01, 0x01, 0x01));


IadpApplicationContext class is a replacement class to Windows Form’s Application class, it’s inherited from ApplicationContext class, and encapsulated Application class, so you can use IadpApplicationContext.Run() to startup message loops like Application.Run(), and use IadpApplicationContext.Exit() to exit application. It’s implemented IADP SDK’s application registration and Crash Report process, developers can do nothing of IADP SDK-related tasks – just use IadpApplicationContext class and its events.

Exception-based Crash Report

Crash Report is a built-in feature of IADP SDK, and provided basic information of exception with DefaultCrashReport, but if developers want to apply more information into Crash Report, they must implement their custom classes derived from DefaultCrashReport and override some methods.

EasyIADP Application Service library includes an implementation of custom Crash Report class, it’s driven by exception, developer can only throw an exception (derived from IadpAppException provided by EasyIADP library), it will be collected by application services and generate Crash Report with custom data field.

It’s very easy; just define your custom exception class derived from IadpAppException like:

public class IadpCustomException : EasyIADP.ApplicationService.IadpAppException
{
    [IadpAppCustomErrorItem]
    public string MyData { get; private set; }
    [IadpAppCustomErrorItem]
    public string RuntimeInfo { get; private set; }

    public IadpCustomException(string Message, string MyData, string RuntimeInfo) : base("APP_CUSTOM", Message)
    {
        this.MyData = MyData;
        this.RuntimeInfo = RuntimeInfo;
    }
}


Note the property in custom class, each property marked with IadpAppCustomErrorItem metadata, it indicate application service must collect value of these properties into custom field of Crash Report (up to 20 items), you can give value of custom fields at constructor or property access, and just throw it at application code:

private void cmdDoCrash_Click(object sender, EventArgs e)
{
    throw new IadpCustomException("TEST_EXCEPTION", "MY_DATA", "RUNTIME_INFO_CUSTOMIZATION");
}


After you added your custom exception and throw exception code, you can launch application with debugger, and fire the code of throw exception, you can see the debugger’s output message will include a path of crash report store information and exit the application, you can find the stored crash report and open it.

Function is in development

Application Upgrade authorization is not tested, you can try it, but I cannot warrant it can work fine.

Demo Application

Demo application of EasyIADP application library is available at package of EasyIADP application library, you can play it for EasyIADP’s function and view the source code for more information of EasyIADP library.

Last edited Aug 4, 2011 at 2:53 AM by regionbbs, version 3

Comments

No comments yet.