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 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.
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
Step 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.
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.
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”.
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();
GPIOButtonInputProvider inputProvider = new GPIOButtonInputProvider(null);
myApplication.Run(mainWindow);
}
private Window mainWindow;
public Window CreateWindow()
{
mainWindow = new Window();
mainWindow.Height = SystemMetrics.ScreenHeight;
mainWindow.Width = SystemMetrics.ScreenWidth;
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;
mainWindow.Child = text;
mainWindow.AddHandler(Buttons.ButtonUpEvent, new RoutedEventHandler(OnButtonUp), false);
mainWindow.Visibility = Visibility.Visible;
Buttons.Focus(mainWindow);
return mainWindow;
}
private void OnButtonUp(object sender, RoutedEventArgs evt)
{
ButtonEventArgs e = (ButtonEventArgs)evt;
Debug.Print(e.Button.ToString());
}
}
}
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.