Note 1: The source code is marked V1.1+ as it contains the code used in the V1.1 release as well as some of the stuff still in development that is hidden in the background.
Note 2: The Build Event code for code signing has been removed as this contained paths and passwords relevant to my build only. There is a description later in the article of the build event code.
Table Of Contents
This article series will be the new home of UltraDynamo. UltraDynamo was my entry to the Intel AppUp Ultrabook™ competition (October 2012) hosted by The CodeProject. The original article for the competition can be found at http://www.codeproject.com/Articles/476010/UltraDynamo
In this article, I will hopefully take you through the various aspects of developing the application, as well as looking at some of the finer detail within the code. As I continue to develop the application (when time allows!) I will hopefully roll the changes/updates and any new interesting aspects back into this article.
Originally this started life as one long article, but decided to split this up into functional aspects, as it became quite unmanageable. As the application develops over time, It will be easier to add in updates to the relevant part and make life slightly easier.
What is UltraDynamo
UltraDynamo is a windows desktop application that makes use of the various sensors available in the next generation of Ultrabooks. These sensors include;
- Ambient Light
The intent of the application is to provide a Rolling Road environment for motor sport enthusiasts that can use the sensors to determine the performance of their vehicles. Technically, it should be possible to perform functions such as;
- Reaction timers
- Acceleration / Braking timers e.g. 0 to 60, 0 to 60 to 0
- Distance timers e.g. quarter mile
- Power Calculations e.g. Brake Horsepower
- Mapping data to GPS locations and overlay onto maps (e.g. Google Maps)
The data can then be presented to the user in various formats, e.g. numerical, charts, pictures.
Is the Application Finished?
Far from it, this is very much a work in progress as time allows. As new features are added or existing features improved, I hope to keep this article series up to date and share the source and compiled applications with the community here on CodeProject.
Can I contribute, make suggestions, report problems?
Of course you can, use the messaging features of Codeproject to either leave a forum message at the bottom of the article sections or drop me a private message via the email link.
Don't expect miracles though, time is limited and I have plenty other things to be doing as well.
My Development Environment
In order to develop this application I am using the following;
- Primary development machine: Windows 8 Pro desktop computer, no sensors, Visual Studio 2012 Pro
- Secondary development machine: Windows 8 Pro laptop computer, no sensors, Visual Studio 2012 Pro
- Test machine: Windows 8 Pro, Ultrabook with Sensor platform, Visual Studio 2012 Pro
- Source Code Repository: Windows 2008 R2 Server running VisualSVN Server
I received the Ultrabook as part of the competition, so did not have that for initial development or testing of the sensors. This made for an interesting work around which I will cover later on. In order to keep all the machines in check, I use VisualSVN Server as a source code repository hosted on my Windows 2008 R2 virtual machine at 1&1. In order to allow the Visual Studio 2012 IDEs to integrate and communicate with the source code repository, I use ankhsvn plugin for Visual Studio. It is a simple case of checking in any code changes on one machine following any edits, then updating source to latest version on the others. This works very well as a method of managing the source from a multi-machine single developer point of view.
The application UltraDynamo is a Windows8 Desktop application using Windows Forms written in C#.
For the code signing tools and access to the sensor diagnostic tools etc. you need to install the Windows 8 Software Development Kit (SDK). It is available from http://msdn.microsoft.com/en-us/windows/hardware/hh852363.aspx[^]
Preparing Visual Studio 2012
The first thing that must be done when developing for Windows 8 and the Windows Runtime (WinRT) was to make a couple of modifications to the project files creates by Visual Studio.
The very first thing to do is create a new Windows Forms C# application and target the relevant .Net framework, in my case .Net 4.5
After this you must unload the project. To do this, from the solution explorer, right click the project and select unload;
Next, In Visual Studio, right click the project and select Edit insertyourprojectname.csproj
Insert the new PropertyGroup just under the main Project element as shown below;
Save the changes, and close the editor window. Next in Solution explorer reload the project again;
The next thing we need to do, is add the suitable references to the Windows Runtime and the sensor libraries. First, In solution explorer, under the project, right click on References and select Add Reference
Finally, we need to add the Sensor library (Windows.Devices.Sensors.dll) and the Introp library (System.Runtime.InteropServices.WindowsRuntime.dll). Repeat the Add Reference process again, but this time select Browse and navigate to where the libraries are stored. See the image below for paths;
In the dashboard image above you will see form makes use of dials. I didn't have a lot of time to go and start writing my own controls or finding different controls to try. Fortunately I found a dial control here on CodeProject. Ambalavanar Thirugnanam had already written and made available for use a control called Aqua Gauge, this was very easy to implement and was a great control to use as an initial implementation.
The source code for the control was dropped into my application and as required the header was left in place;
V1.1 - This used the improved sensor manager code, added the double buffering to the drawing aspects and re-instated the simulator code. The first test code of the reaction timers is present in the source, but not available to the user.
V1.0 - This was the first rushed out the door code. It had flickering displays, the simulator code was disabled and hidden from view.
On To The Next Part
In the next section we will take a look at the sensors.
Part 2 - It is all about the sensors