Part 17: Introducing the Coding4Fun Toolkit

Part 17: Introducing the Coding4Fun Toolkit

Update: 2013-06-26
Share

Description

Source Code: https://aka.ms/absbeginnerdevwp8
PDF Version: https://aka.ms/absbeginnerdevwp8pdf

Recording a custom sound in our app would be difficult to code by hand. Fortunately, your friends at Coding4Fun, and Clint Rutkas specifically, have created a Toolkit for Windows Phone that hides the complexity behind easy to use programmatic interfaces. If you're not familiar with Coding4Fun, it's a Channel9 site that engages in geeky cool projects, not your standard business apps ... they usually use hardware like the Kinect as the interface for controlling things such as boxing robots and even a Ford Mustang that was heavily modified with Microsoft technology ... just to prove that it could be done.

https://channel9.msdn.com/coding4fun

Clint is usually in the center of these projects and he is the author and curator of the Coding4Fun Toolkit.

By using this package in our project, we get some additional tools we can utilize in our apps such as a little "About This App" message box (the AboutPrompt) suited for Windows Phone development. In this lesson, I'll demonstrate how to install the Coding4Fun Toolkit package into our app using NuGet. Once we install it, we'll use it to implement the AboutPrompt.

In this short lesson, our game plan is to:

  1. Use NuGet to install the Coding4Fun Toolkit package into our solution.
  2. Snoop around and see what it added.
  3. Add an AboutPrompt to our app.

Update to series: Being sure we have the newest version of NuGet.

With a fresh install of Visual Studio 2012, we’ll need to update NuGet to get some of the newer packages such as the Coding4Fun Toolkit.  It is a super easy process and can be done in a few clicks.

  1. Go to the Tools Menu –> Extensions and Updates
  2. Go to the Update Tab –> Visual Studio Gallery

    nugetUpdate
  3. Click Update
  4. Restart Visual Studio

1. Install the Coding4Fun Package

There are many ways to get to the NuGet package manager ... this time we'll right-click on the References folder and select "Manage NuGet Packages ...":

Generic Episode Image

 

This will open up the Manage NuGet Packages Dialog:

Generic Episode Image

 

  1. In the Search box, search for: "Coding4Fun".
  2. Click the Install button next to the "Coding4Fun Toolkit - Complete" package ... Clint split up the Coding4Fun toolkit into sub-packages so that developers can just pick and choose the parts they want in their project. However, for simplicity—and because we'll use a few different parts and want to familiarize ourselves with the package, we'll choose to install the Complete version.

After a few moments, you'll see green checkmarks next to the packages that were installed:

Generic Episode Image

 

... and you can click the Close button that in dialog to close it.

Now, in the Solution Explorer, you can see new References that were added:

 

Generic Episode Image

 

... also, a new folder called Toolkit.Content and a ReadMe.Coding4Fun.Toolkit.txt file were added:

 

Generic Episode Image

 

Opening the ReadMe.Coding4Fun.Toolkit.txt file, we can see versioning information (what changed) and migration notes:

 

Generic Episode Image

 

2. Employing the AboutPrompt

We'll take the simple step of adding an AboutPrompt to the app. When the user selects the "About" menu option, we want to display a popup:

 

Generic Episode Image

 

We're missing a using statement, so use the hover-over-the-blue-dash-technique to add the appropriate using statement to the code file:

 

Generic Episode Image

 

Once we've resolved the reference to the AboutPrompt class, we'll call it's Show() method. There are many overloaded versions of this method, but we'll pass in the following information ...

 

Generic Episode Image

 

... which produces the following results:

 

Generic Episode Image

 

It's quick and simple and for this particular app, we probably need nothing more fancy.

Leveraging open source (or even commercial) packages is a great way to add features quickly to your development projects. The whole .NET community on CodePlex is built on sharing packages, components, templates and so on to help each other quickly implement features. You can save yourself a lot of time during your career by spending a few hours exploring the work of others before going off and writing your own. Alternatively, use the search box on the NuGet Package Manager to find similar packages and evaluate the strengths and weaknesses of each one relative to the needs of your project.

 

Recap

To recap, in this lesson we leveraged the Coding4Fun Toolkit to add one small feature now as well as one large feature later in this series. We learned how to add packages to our app using the NuGet Package Manager dialog, how to read the description of the package to learn more, and how packages can be subdivided to minimize unnecessary references and complexity in our projects.

Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

Part 17: Introducing the Coding4Fun Toolkit

Part 17: Introducing the Coding4Fun Toolkit

Bob Tabor, Clint Rutkas