I've read on a forum that someone asked if someone has never developed Windows Vista Gadgets that can interact with Dynamics NAV data.
Actually I've not seen any Vista gadget for this task (something will be ready with the NAV 5.1 version), but if you've time you can start your own Gadget creation, and here I want to leave you the ideas on how to do this task.
Windows Vista Gadgets seems a really complicated technology but if you carefully analize how the standard Vista Gadgets are made, you discover that gadgets are really nothing more than HTML files with some scripting code on them.
In order to create a Vista Gadget, you need:
- A “manifest” file named Gadget.xml that contains all the settings for your gadget.
- An HTML file with your scripting code.
The manifest file contains the gadget configuration and its format is something like this:
<?xml version="1.0" encoding="utf-8" ?>
<gadget>
<name>Dynamics NAV Gadget</name>
<author>Stefano Demiliani</author>
<description>Microsoft Dynamics NAV Gadget</description>
<icons>
<icon>MyGadgetIcon.jpg</icon>
</icons>
<version value="1.0.0.0" MinPlatformVersion="0.1"></version>
<sidebar>
<type>html</type>
<permissions>full</permissions>
<code>NAVGadget.html</code>
<website>www.demiliani.com</website>
</sidebar>
</gadget>
where NAVGadget.html is the HTML file with the scripting code.
This HTML file is nothing more than a web page that uses scripting (VBScript or Jscript) to retrieve data from a NAV database (SQL Server) and display them. So, you can write your own HTL file that will contain something like this:
<html>
<head>
<title>My First Gadget</title>
<style>
body{width:120;height:160}
</style>
</head>
<script language="VBScript">
Set myConn = CreateObject("ADODB.Connection")
Set myRecordset = CreateObject("ADODB.Recordset" )
myConn.Open = DB_CONNECTION_STRING
myRecordset.Open mySQLCmdText, myConn
myRecordset.MoveFirst
WHILE NOT myRecordset.EOF
Response.Write(myRecordset("myField") & "<br/>")
myRecordset.MoveNext
WEND
myRecordset.Close
Set myRecordset = Nothing
myConn.Close
Set myConn = Nothing
</script>
</html>
where DB_CONNECTION_STRING is the connection string that connects to Dynamics NAV database and mySQLCmdText is the query that you want to execute (for example a query to retrieve the last 10 Orders).
To install the Gadget on your sidebar, open the Gadgets folder under %userprofile%\appdata\local\microsoft\windows sidebar\gadgets, then create a new folder for your newly created Gadget (called for example NAVGadget.gadget). Remember that the .gadget extension is a must!!
Now place your HTML file and your gadget.xml file into this folder and restart the Windows Sidebar. If you try to add a new gadget on the sidebar, your newly created gadget should appear in the gadget picker dialog box. 