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









Image sourcemsdn.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



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 Next 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”. 





Next 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(); 
   
            // 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





Conclusion



This article helps you to understand .NET Micro Framework and AGENT SDK with Agent Smartwatch apps using Visual Studio 2015.