Getting Started With Agent SmartWatch Apps Using .NET Micro Framework

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 the 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 supporst smallest device, SPOT Watches, GPS navigation devices, and Windows Vista Sideshow displays.

 
 
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

Agnet SDK

Steps 1: Double click “agentsdk”.

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

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

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


Microsoft .NET Micro Framework SDK

Steps 2: Double Click “MicroFrameworkSDK”

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



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


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



The Microsoft .NET Micro Framework SDK 4.3 setup wizard IS open and click Install button.
 
 
Getting started with setup installation process for the .NET Micro Framework SDK setup.
 


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

 
Steps 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.


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


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

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

Steps 4: 

  1. using System;  
  2.   
  3. using Microsoft.SPOT;  
  4. using Microsoft.SPOT.Input;  
  5. using Microsoft.SPOT.Presentation;  
  6. using Microsoft.SPOT.Presentation.Controls;  
  7.   
  8. namespace AgentSmartWatchApps  
  9. {  
  10.     public class Program : Microsoft.SPOT.Application  
  11.     {  
  12.         public static void Main()  
  13.         {  
  14.             Program myApplication = new Program();  
  15.   
  16.             Window mainWindow = myApplication.CreateWindow();  
  17.   
  18.             // Create the object that configures the GPIO pins to buttons.  
  19.             GPIOButtonInputProvider inputProvider = new GPIOButtonInputProvider(null);  
  20.   
  21.             // Start the application  
  22.             myApplication.Run(mainWindow);  
  23.         }  
  24.   
  25.         private Window mainWindow;  
  26.   
  27.         public Window CreateWindow()  
  28.         {  
  29.             // Create a window object and set its size to the  
  30.             // size of the display.  
  31.             mainWindow = new Window();  
  32.             mainWindow.Height = SystemMetrics.ScreenHeight;  
  33.             mainWindow.Width = SystemMetrics.ScreenWidth;  
  34.   
  35.             // Create a single text control.  
  36.             Text text = new Text();  
  37.   
  38.             text.Font = Resources.GetFont(Resources.FontResources.small);  
  39.             text.TextContent = Resources.GetString(Resources.StringResources.String1);  
  40.             text.HorizontalAlignment = Microsoft.SPOT.Presentation.HorizontalAlignment.Center;  
  41.             text.VerticalAlignment = Microsoft.SPOT.Presentation.VerticalAlignment.Center;  
  42.   
  43.             // Add the text control to the window.  
  44.             mainWindow.Child = text;  
  45.   
  46.             // Connect the button handler to all of the buttons.  
  47.             mainWindow.AddHandler(Buttons.ButtonUpEvent, new RoutedEventHandler(OnButtonUp), false);  
  48.   
  49.             // Set the window visibility to visible.  
  50.             mainWindow.Visibility = Visibility.Visible;  
  51.   
  52.             // Attach the button focus to the window.  
  53.             Buttons.Focus(mainWindow);  
  54.   
  55.             return mainWindow;  
  56.         }  
  57.   
  58.         private void OnButtonUp(object sender, RoutedEventArgs evt)  
  59.         {  
  60.             ButtonEventArgs e = (ButtonEventArgs)evt;  
  61.   
  62.             // Print the button code to the Visual Studio output window.  
  63.             Debug.Print(e.Button.ToString());  
  64.         }  
  65.     }  
  66. }  

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



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.
 
Read more articles on Wearables:


Similar Articles