Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / All-Topics

Getting Started With Agent SmartWatch Apps

5.00/5 (1 vote)
17 Feb 2016CPOL2 min read 8.5K  
How to get started with agent Smartwatch apps

Today, we are going to discuss the .NET Micro Framework, SmartWatch apps, and we will also develop, run and deploy the apps to emulator. We can build our wearable smartwatch apps using .NET Micro Framework. We require the prerequisite Software Agent SmartWatch SDK, .NET Micro Framework SDK and Visual Studio 2015.

What is .NET Micro Framework?

.NET Micro Framework (formerly know as SPOT) is a powerful and flexible platform for rapidly creating embedded device firmware with Microsoft Visual Studio. SPOT is called Smart Personal Object Technology and its support smallest device, SPOT Watches, GPS navigation devices, and Windows Vista Sideshow displays.

Image 1

Image source: msdn.microsoft

Prerequisites

  • Visual Studio 2015
  • Agent SDK v0.3
  • Microsoft .NET Micro Framework SDK v4.3

First, we need to set up the environment:

  • Microsoft .NET Micro Framework SDK v4.3
  • Agent SDK v0.3

Agent SDK

Step 1: Double click “agentsdk”

The AGENT SDK v0.3 Setup will open and then select checkbox license terms and click Install button.

Image 2

Getting started with setup initializing process for the Agent SDK setup.

Image 3

After it is successfully installed in Agent SDK, you can see the following screen and click Close button.

Image 4

Microsoft .NET Micro Framework SDK

Step 2: Double Click “MicroFrameworkSDK”

The Microsoft .NET Micro Framework SDK 4.3 Setup will open and click Install button.

Image 5

The Microsoft .NET Micro Framework SDK 4.3 setup wizard is open now. Select checkbox for license terms and click Next button.

Image 6

The Microsoft .NET Micro Framework SDK 4.3 setup wizard is open now. Select checkbox Typical and click Next button.

Image 7

The Microsoft .NET Micro Framework SDK 4.3 setup wizard IS open and click Install button.

Image 8

Getting started with setup installation process for the .NET Micro Framework SDK setup.

Image 9

After it is successfully installed in .NET Micro Framework SDK, you can see the following screen and click Finish button.

Image 10

Step 3: Create a sample application using .NET Micro Framework and deploy the emulator

Open Visual Studio 2015 and go to file menu and point new and then click new project, where you can see the section Visual C# Template. Click Micro Framework, then select Window Application and type Project Name AgentSmartWatchApps. Choose the project location path and then click OK button.

Image 11

You can see AgentSmartWatchApps project structure as in the following screenshot:

Image 12

Go to Solution Explorer, right click the project name and select an Application option. Select a target framework “.NET Micro Framework 4.3”.

Image 13

Go to Solution Explorer and right click the project name and select .NET Micro Framework option, then a device “AGENT Emulator”.

Image 14

C#
using System;  
	  
using Microsoft.SPOT;  
using Microsoft.SPOT.Input;  
using Microsoft.SPOT.Presentation;  
using Microsoft.SPOT.Presentation.Controls;  
  
namespace AgentSmartWatchApps  
{  
    public class Program : Microsoft.SPOT.Application  
    {  
        public static void Main()  
        {  
            Program myApplication = new Program();  
	  
            Window mainWindow = myApplication.CreateWindow();  
	  
            // Create the object that configures the GPIO pins to buttons.  
            GPIOButtonInputProvider inputProvider = new GPIOButtonInputProvider(null);  
	  
            // Start the application  
            myApplication.Run(mainWindow);  
        }  
	  
        private Window mainWindow;  
	  
        public Window CreateWindow()  
        {  
            // Create a window object and set its size to the  
            // size of the display.  
            mainWindow = new Window();  
            mainWindow.Height = SystemMetrics.ScreenHeight;  
            mainWindow.Width = SystemMetrics.ScreenWidth;  
	  
            // Create a single text control.  
            Text text = new Text();  
	  
            text.Font = Resources.GetFont(Resources.FontResources.small);  
            text.TextContent = Resources.GetString(Resources.StringResources.String1);  
            text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;  
            text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;  
  
            // Add the text control to the window.  
            mainWindow.Child = text;  
	  
            // Connect the button handler to all of the buttons.  
            mainWindow.AddHandler(Buttons.ButtonUpEvent, new RoutedEventHandler(OnButtonUp), false);  
	  
            // Set the window visibility to visible.  
            mainWindow.Visibility = Visibility.Visible;  
	  
            // Attach the button focus to the window.  
            Buttons.Focus(mainWindow);  
	  
            return mainWindow;  
        }  
	  
        private void OnButtonUp(object sender, RoutedEventArgs evt)  
        {  
            ButtonEventArgs e = (ButtonEventArgs)evt;  
	  
            // Print the button code to the Visual Studio output window.  
            Debug.Print(e.Button.ToString());  
        }  
    }  
}

Run and Test the Agent Smartwatch “Hello World” apps.

Image 15

Conclusion

This article helps you to understand .NET Micro Framework and AGENT SDK with Agent Smartwatch apps using Visual Studio 2015. Thank you for reading my articles. Kindly share your comments or suggestions.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)