API v10 Documentation & Development Guide


Contents


Native Widget Development (using C#/VB.Net WPF)

Requirements

Documentation
For developing Native Widgets (i.e. Newgen compatible compiled dlls), we provide you a 'MS Visual Studio 10' compatible C# Project Template. Everything needed is defined there. You just need get 'Newgen.Base.dll' added to references from the latest version Newgen. But don't pack this dll while submitting you widget to Store or to public.

Newgen.Base.dll - This contains all necessary and extended methods for making a Newgen compatible widget.

class Newgen.Base.E & Newgen.Base.Helper - These contains all runtime details exposed by Newgen and you can use this to store your runtime data shared between different widgets. There are also few highly-optimized static methods for very common tasks, like getting a image without locking file, playing a sound, getting current background color of Newgen to match with it your widgets, or quickly animating any WPF object. You advised to use these only if required.

class Newgen.Base.NewgenWidget - You must implement this abstract class in your dll, as this is only the way to make Newgen see your dll as a widget. But, don't worry it's already done for you in template.

class Newgen.Base.HubWindow - A hub is full-screen window for displaying your presentation. This class or WPF control helps you to do that.

class Newgen.Base.MessagingHelper - Provides you methods to send messages to other widgets and Newgen.
Key Details
TEST For testing, displays a dialog box with all arguments.
POPMSG For displaying a information message box with given message and a OK button.
POPERR For displaying a error message box with given error message and a OK button.
URL For displaying a browser with given URL, i.e. it opens web browser with given URL.
Newgen.Base.MessagingHelper.SendMessageToNewgen("URL""http://ftware.blogspot.com");
Newgen.Base.MessagingHelper.SendMessageToWidget("Internet""http://ftware.blogspot.com");
NOTE: In case of sending message to widget, the key is the name of widget. To receive messages to your widget, you must implement the following code in class which inherits class Newgen.Base.NewgenWidget
public override void HandleMessage(string message)
{
    switch (message)
    {
                ...
    }
}
 

Implementation of any class or method is not described here because it's already done in template.


HTML Widget Development (using HTML, XHTML, HTML5, ...)

Requirements

Documentation
For developing HTML widget, you require very basic knowledge of HTML and JavaScript.
We've already prepared a sample HTML widget. You can download it from here.
You're free to use any code inside HTML widget which meet simple HTML Web Development standards. You can use the HTML5, CSS3 codes also.
But, don't use any animation in content file (that is show in Tiles, generally Tile.html). And don't request any other MIME type (other than jpg, png, jpeg, gif, html, js, css) because Newgen server doesn't support that.

Newgen provides a minimal API using javascript in HTML widgets.

$Newgen - This the javascript object, that contains all the methods described below. You access it using javascript. NOTE: Be sure to enclose your all javascript inside some error handler, as in sample, because HTML API takes some time to get available.
$Newgen. // Any method listed below, after dot '.'

$Newgen.Version() - Returns the version of Newgen.
var ver = $Newgen.Version();
This will trigger the Newgen to get current version.

$Newgen.LicenseStatus() - Returns the current status of license loaded in Newgen. Possible values are LICENSED, TRIALVERSION.
var ls = $Newgen.LicenseStatus();
This will trigger the Newgen to get current license status.

$Newgen.CloseHub() - Closes the currently opened hub.
<button onclick="$Newgen.CloseHub()">Click here to close this hub</button>
This will trigger the Newgen to close the hub.

$Newgen.SendMessage(key,msg) - Sends a message to Newgen using given key and message. Here is list of supported Keys -
Key Details
TEST For testing, displays a dialog box with all arguments.
POPMSG For displaying a information message box with given message and a OK button.
POPERR For displaying a error message box with given error message and a OK button.
NOTE* Although you can use the keys exposed by Native API but, they might cause errors.
<button onclick="$Newgen.SendMessage('TEST','Hello world !')">Click here to send message to Newgen</button>
This will trigger the Newgen to show a dialog box with 'Hello world !'. Here 'TEST' is key and 'Hello world !' is message content.

$Newgen.ASD(wn, data, callback) - This means Append OR Save data. It enables you to save any string data to local file. Here, wn is widget's name. It returns response using callback and a argument (function (r)...), true if process was successful else false.
<button onclick="$Newgen.ASD('My HTML Widget','Hello world !', function (r) {alert('Saved !')})">
This will trigger the Newgen to save 'Hello world !' to a local file. If no error occurs, a message box will show 'Saved !'.

$Newgen.GSD(wn, data, callback) - This means Get Saved data. It enables you to get the data that was saved to local file. Here, wn is widget's name. It returns response using callback and a argument (function (r)...), saved data if process was successful else false.
<button onclick="$Newgen.GSD('My HTML Widget', function (r) {alert(r)})">
This will trigger the Newgen to get saved data from local file. If no error occurs, a message box will show the data that was saved.

$Newgen.CSD(wn, data, callback) - This means Clear Saved data. It enables you to clear the data that was saved to local file. Here, wn is widget's name. It returns response using callback and a argument (function (r)...), true if process was successful else false.
<button onclick="$Newgen.CSD('My HTML Widget', function (r) {alert(r)})">
This will trigger the Newgen to clear saved data from local file. If no error occurs, a message box will show 'true'.


Packing widgets using WPE - Part of Newgen WDK

For packing widgets you must download Newgen WDK or just WPE.exe.
WPE is a command like utility for packing files into installable .nwp package (i.e. Newgen Widget Package).
Now, when you'll open WPE.exe, it'll ask you few values. You'll need to fill out all values as possible.
You can also directly send all values altogether to WPE, using Command prompt or directly integrate it into your build tool.

Format: WPE -P "Path to you widget contents" -O "Output path for packed .nwp file" -W "Name" -I "ID" -V "Version" -D "Description" -A "Author" -AW "Website"

If you can't install widget by clicking it, you'll can pass this command to Newgen.exe to do that "Newgen.exe -nwp "Path to .nwp file""


Making widgets available in Newgen Store

Newgen Store requires, that your widget must be approved first before being available for public.
You must provide correct information before uploading widget for approval. We can contact you at anytime.
Id for your widget must be unique, i.e. it should not collide with any other widget's else it'll be changed by us without any notification.
You can upload your widget (packed in .nwp) for approval from here.


Links, downloads



For any other details or query, feel free to contact.
2013 NS.