Smart Space 11.1.1: Creating Your First Smart Space Gadget |
"Hello World" Example
This section describes how to create a Smart Space gadget that displays the toast message "Hello World" on your computer. The gadget can be created using either C# or VB.NET.
To create the example:
- Open Visual Studio and select
- From Visual C# (or Visual Basic), Templates, click .
- Optional: Update the gadget name, the location and the solution name, and click .
- Enter a namespace, and click .

Tip: If you change the namespace later, you must edit the type field in the configuration.xml
file to match.
- From the Solution Explorer, double-click (or ).
- Select .
- At the top of the file under the
using (or Imports) statements, add the following line of code:
Imports Oracle.SmartSpace.Sdk.Services |
using Oracle.SmartSpace.Sdk.Services; |
Tip: This code imports Smart Space Services namespace to allow for more convenient
coding.
- Select .
- From the Toolbox, drag a button onto the form and click the button once to select it.
- In the Properties window, set the following properties:
a. Name to displayToastButton
b. Text to Display Toast Message
c. Width to 145
Tip: Click the property, then update the .
- Double-click the button to add an event handler for the
Click event. The Code Editor will open with the insertion point placed within the event handler.
- Insert this code at the cursor:
Me.Services.ToastManager.Show("Hello World!") |
this.Services.ToastManager.Show("Hello world!"); |
- To save, select .
Debugging and Testing
Use debug to run your code.
Tip: You must have the Smart Space client installed and running on your computer to debug.
Tip: If you run without debugging, you cannot test your gadget in the Smart Space client.
- Select .
Your gadget appears in the Smart Space palette.
- Double-click the gadget to add it to a Smart Space desktop.
- To test the Hello World! example, click Display Toast Message
The toast message Hello World! appears in the bottom right corner of your screen.
- Select .
Building
After you create, debug and test a gadget you can build it within Visual Studio, which makes it available for publishing.
- From Visual Studio Solution Explorer, right-click the gadget and select .
- Specify a location to store the gadget. The
gadgetname.SmartSpaceGadget file is created, where gadgetname is the name of your gadget.
- To make this gadget available to users, publish it to an existing Smart Space installation. Please see "Publishing a Gadget or Service" in the "Administrator's Help" document in Smart Space Online Help.
|