Visual Studio Live! - Orlando

Posted October 13, 2014 10:13 PM Categories: Gaming | VSLive Orlando | Windows 8.1 | Windows Phone | Async | Events

I will be presenting 3 sessions at Visual Studio Live! in Orlando this November 17-21.  The conference is a full 5 day event, and part of the Live! 360 conference, covering SharePoint, SQL Server, Modern Apps and more.  Plus, there’s still time to register and save $600 if you register before 10/15/14!  For this event, I’ll be presenting:

VSH03 Games Development with Unity and Other Frameworks for Windows and Windows Phone
Date: Thursday, November 20, 2014
Time: 8:00am – 9:15pm
Level: Introductory

There are a variety of platforms and frameworks which can be used to build games on both Windows and Windows Phone depending on the complexity of the game and the developer's skill level. In this session, we will delve into the many options available to developers, including DirectX, Unity, MonoGame, and more!

VSH08 Writing Asynchronous Code using .NET 4.5 and C# 5.0
Date: Thursday, November 20, 2014
Time: 9:30am – 10:45pm
Level: Introductory

A variety of new features were added to the .NET 4.5 Framework, including support for easily writing asynchronous code. This session will introduce the concepts of asynchronous programming, .NET Tasks, how to ensure your UI remains responsive, and how to do all of this properly in your own applications using the new "async"and "await" keywords. If you're looking for ways to provide a better, smoother experience for your users, don't miss this session!

VSH10 Building Your First Universal Application for Windows Phone and Windows Store
Date: Thursday, November 20, 2014
Time: 11:00am – 12:15pm
Level: Introductory

Universal Apps enable developers to build apps for Windows Store and Windows Phone simultaneously while sharing code, controls, and other assets between them. In this session, you will learn how Universal Apps work as we build a simple app from start to finish using this new project type. We will cover what can and can't be shared, and how to best structure your project for maximum re-use.

LSPK61

Get more information on the conference at:

Visual Studio Live! – Washington DC

Posted September 8, 2014 12:43 PM Categories: Gaming | VSLive | Events | Windows Phone | Windows Runtime

I will be presenting 2 sessions at Visual Studio Live! in Washington DC this October 6-9.  The conference is a full 4 day event and there’s still time to register and save $400 if you register before 9/10/14!  For this event, I’ll be presenting:

TH07 Building Your First Windows Phone 8.1 Application
Date: Thursday, October 9, 2014
Time: 9:30am – 10:45pm
Level: Introductory

Expand your mobile horizons with Windows Phone! Developing applications for the phone is quite similar to building XAML applications for other platforms. In this session, Brian will demonstrate the fundamentals of Windows Phone development while building a very simple application which covers all of the important points of the new platform's architecture, including the developer tools, device emulator and touch input. We will also discuss what's new with the Windows Phone 8.1 update and how you can use it to build better apps.

TH11 Building Games for Windows and Windows Phone
Date: Thursday, October 9, 2014
Time: 11:00am – 12:15pm
Level: Introductory

There are a variety of platforms and frameworks which can be used to build games on both Windows and Windows Phone depending on the complexity of the game and the developer's skill level. In this session, we will delve into the many options available to developers, including DirectX, Unity, MonoGame, and more!

DCSPK22

Get more information on the conference at:

Visual Studio Live! – Redmond

Posted May 27, 2014 8:03 PM Categories: Events | VSLive Redmond | Async | Visual Studio

I will be presenting 2 sessions at Visual Studio Live! in Redmond this August 18-22.  The conference is a full 4 day event and there’s still time to register and save $500 if you register before 6/11/14!  For this event, I’ll be presenting:

TH15 Performance and Diagnostics Hub in Visual Studio 2013
Date:
Thursday, August 22, 2014
Time: 11:00am – 12:15pm
Level: Intermediate

Visual Studio 2013 has introduced a new Performance and Diagnostics hub which encompasses a variety of new and old tools to profile your Windows Store applications. In this session, we will take a detailed look at all of the tools that the Performance and Diagnostics Hub has to offer with both XAML and HTML/JavaScript Windows Store apps.

TH25 Writing Asynchronous Code Using .NET 4.5 and C# 5.0
Date:
Thursday, August 22, 2014
Time: 3:45pm – 5:00pm
Level: Introductory

A variety of new features were added to the .NET 4.5 Framework, including support for easily writing asynchronous code. This session will introduce the concepts of asynchronous programming, .NET Tasks, how to ensure your UI remains responsive, and how to do all of this properly in your own applications using the new "async" and "await" keywords. If you're looking for ways to provide a better, smoother experience for your users, don't miss this session!

RDSPK23

Get more information on the conference at:

Connect to a Bluetooth Serial Device with Xamarin.Android

Posted April 27, 2014 3:48 PM Categories: .NET | Android | Bluetooth | Hardware | Xamarin

Xamarin channelI have been exploring the Xamarin tools recently and decided to try my hand at connecting some Bluetooth hardware to Android for a project that will be released soon.  I have learned quite a bit about Bluetooth on Android and decided to write up a short description on how to connect to a Bluetooth serial device via RFCOMM/SPP.

First, grab an instance of the default BluetoothAdapter on the Android device and determine if it is enabled:

BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter;
if(adapter == null)
    throw new Exception("No Bluetooth adapter found.");

if(!adapter.IsEnabled)
    throw new Exception("Bluetooth adapter is not enabled.");

Next, get an instance of the BluetoothDevice representing the physical device you’re connecting to.  You can get a list of currently paired devices using the adapter’s BondedDevices collection.  I use some simple LINQ to find the device I’m looking for:

BluetoothDevice device = (from bd in adapter.BondedDevices 
                          where bd.Name == "NameOfTheDevice" select bd).FirstOrDefault();

if(device == null)
    throw new Exception("Named device not found.");
Finally, use the device’s CreateRfCommSocketToServiceRecord method, which will return a BluetoothSocket that can be used for connection and communication. Note that the UUID specified below is the standard UUID for SPP:
_socket = device.CreateRfcommSocketToServiceRecord(UUID.FromString("00001101-0000-1000-8000-00805f9b34fb"));
await _socket.ConnectAsync();

Now that the device is connected, communication occurs via the InputStream and OutputStream properties which live on the BluetoothSocket object  These properties are standard .NET Stream objects and can be used exactly as you’d expect:

// Read data from the device
await _socket.InputStream.ReadAsync(buffer, 0, buffer.Length);

// Write data to the device
await _socket.OutputStream.WriteAsync(buffer, 0, buffer.Length);

That’s it!  Now to get things working with iOS…

Visual Studio Live! – Chicago

Posted April 8, 2014 3:04 AM Categories: .NET | Async | Events | VSLive Chicago

I will be presenting 2 sessions and speaking on the closing panel at Visual Studio Live! in Chicago this May 5-8.  The conference is a full 4 day event and there’s still time to register and save $200 if you register before 4/16/14!  For this event, I’ll be presenting:

TH10 Performance and Diagnostics Hub in Visual Studio 2013
Date:
Thursday, May 8, 2014
Time: 11:00am – 12:15pm
Level: Intermediate

Visual Studio 2013 has introduced a new Performance and Diagnostics hub which encompasses a variety of new and old tools to profile your Windows Store applications. In this session, we will take a detailed look at all of the tools that the Performance and Diagnostics Hub has to offer with both XAML and HTML/JavaScript Windows Store apps.

TH20 Writing Asynchronous Code Using .NET 4.5 and C# 5.0
Date:
Thursday, May 8, 2014
Time: 3:00pm – 4:15pm
Level: Introductory

A variety of new features were added to the .NET 4.5 Framework, including support for easily writing asynchronous code. This session will introduce the concepts of asynchronous programming, .NET Tasks, how to ensure your UI remains responsive, and how to do all of this properly in your own applications using the new "async" and "await" keywords. If you're looking for ways to provide a better, smoother experience for your users, don't miss this session!

I’ll also be speaking on the Conference Wrap-Up Panel at 4:30pm on Thursday.  Come and ask questions!

CHSPK23

Get more information on the conference at:

 

NuGet-enabled WiimoteLib and ThinkGearNET

NuGet-enabled WiimoteLib and ThinkGearNET

Posted January 21, 2011 3:00 AM Categories: .NET | Neurosky MindSet | NuGet | Visual Studio | Wiimote

With the official release of NuGet and the NuGet gallery, I decided to try it all out by uploading the current versions of WiimoteLib and ThinkGearNET to the gallery.  The process was pretty smooth, but I learned a little bit along the way which I thought I’d share.

So what’s NuGet?
From their own page:  NuGet (formerly known as NuPack) is a free, open source developer focused package management system for the .NET platform intent on simplifying the process of incorporating third party libraries into a .NET application during development.

In short, this means you can right-click and add a reference to a third party library without having to download it yourself, extract it, locate it manually on your drive, deal with dependencies, etc.  All of this is handled automatically, as is finding and integrating new versions of those libraries with your projects.

NuGet as a User
If you want to use NuGet to download packages, you’ll first need to install the NuGet Package Manager extension for Visual Studio 2010.  You can find this in the Visual Studio Extension Manager or at the NuGet CodePlex site

image

Install the extension and you’ll find a new right-click entry when adding a reference: Add Library Package Reference….

image

Select this and you’ll be presented with a dialog similar to that of the Extension Manager.  You can see/search what’s installed, what’s in the gallery, and which packages you already have installed have updates available.  As an example, you can search for WiimoteLib or ThinkGearNet and pull down the package.

image

In either case, a reference will be set to the assembly, and, with the way I created the package, you’ll get a readme file as well as an Extras directory with additional documentation, license info, samples, etc.

NuGet as a Package Developer
If you are the developer of a third party library, getting it up to the NuGet Gallery for the rest of the world to consume is pretty simple.  Full documentation on all of the advanced features is located on CodePlex, but I’m going to explain the basics using WiimoteLib as an example.

First, you will need to download the command line NuGet Command Line Tool from CodePlex to create packages.  Put this executable in a location in your PATH or somewhere else that’s easily accessible.

Next, you will need to organize your library, documentation, etc. in a way that NuGet can handle.  Three main directories will exist inside any package.  Use those which make sense for your distribution.

Directory

Usage

\lib The assemblies that will be referenced by the user’s project when this package is installed
\content Anything in here will be copied to the user’s project root and added to the project/solution
\tools Executables that will get copied to the target project and will be added to the PATH environment variable

For my packages, I only needed the lib and content directories.  Inside of the lib directory, I copied the WiimoteLib.dll assembly.  Inside of the content directory, I created a directory named Wiimote_Extras in addition to a Wiimote_Readme.txt file.  Inside the Wiimote_Extras directory, I placed a zipped copy of the WiimoteLib samples, a docs directory containing the CHM help file and license files, and a MSRS directory containing the MSRS libraries for the Wiimote.  So, my full directory list looked as follows:

image

One of the issues I ran into was including the samples as projects/source directly.  When they get added to the project as shown, they become source code for the project, and that can cause conflicts.  So, to work around the issue, I just zipped up the projects and made them easily accessible.  Just remember if you include a source code file directly in that content directory, it will become part of the user’s project.

You can go much further with this by specifying subdirectories for different versions of your library with multiple subdirectories, PowerShell scripts, etc. but for my needs this was all that was required.

The final piece of the puzzle is creating a manifest file, called the .nuspec file, which details the package and its contents.  You can find full documentation for the .nuspec file on CodePlex, but I’ll cover the basic items that are required.  Here is the .nuspec file for WiimoteLib:

<?xml version="1.0" encoding="utf-8"?> 
<package> 
  <metadata> 
    <id>WiimoteLib</id> 
    <version>1.7</version>
    <title>WiimoteLib</title>
    <authors>Brian Peek</authors>
    <description>Managed Library for Nintendo's Wiimote</description> 
    <summary>A library for using a Nintendo Wii Remote (Wiimote) from .NET.</summary>
    <language>en-US</language>
    <licenseUrl>http://wiimotelib.codeplex.com/license</licenseUrl>
    <projectUrl>http://wiimotelib.codeplex.com/</projectUrl>
    <tags>Wiimote Nintendo Games</tags>
  </metadata> 
</package>

Of the items listed, only the id, version, authors and description fields are required.  The rest add some useful data that will get displayed in the package manager and on the Gallery site.

Element

Description

id A unique identifier for the package.  Make this something short but unique.
version The version of the library this package contains
title A pretty title for the package
authors A comma-delimited list of authors
description A longer description of the package
summary A shorter description of the package
language Locale ID for the package
licenseUrl URL pointing to the license file on the web
projectUrl URL pointing to the project homepage on the web
tags A space-delimited list of tags to help find the package when searching

When uploading to the NuGet Gallery, everything but the id and version can be added or changed on the site itself.  These items are used for display both on the NuGet Gallery site, as well as inside the package manager in Visual Studio.

So, create your .nuspec file and save it somewhere to be reference for the next step.

With the directory organized and the .nuspec file in place, the package can be created with the nuget.exe command line tool downloaded earlier.  At its simplest the command to create a package is as follows:

 
nuget pack <.nuspec file> –b <root package directory>

Running this command will generate a file with a .nupkg extension.  This is your final package ready to upload to the Gallery!

Currently, if you wish to upload a package, you need to register on the NuGet Gallery and then send an email to the address specified to have your account activated.  Once activated, go to the Contribute tab on the site, click Add New Package and follow the steps.  When complete, your package will be available to download by anyone with the package manager installed.

Conclusion
There is obviously a ton more to NuGet, the package manager, the package creator, etc. and I highly recommend going through the documentation on the NuGet CodePlex site to get the full details.  Your package may be far more advanced than this and require additional configuration, so please read up!  Otherwise, take a look at the gallery and get started using some third party libraries in your projects!

Add comment