Part III – Using Advanced GUI Elements in PowerShell


This post is part of the Learning GUI Toolmaking Series, here on FoxDeploy. Click the banner to return to the series jump page!

Welcome back to the GUI Series here on! In the previous weeks, I’ve had a lot of feedback and requests from you guys (which I absolutely love! Assuming I don’t need sleep, I’m content to stay up till the wee hours of the morning helping you guys out and responding to your comments or requests, so keep ’em coming!). As for where this blog is heading…I’ve really been bit hard by the maker bug, and I recently purchased a RaspBerry Pi 2, which is super awesome and incredibly powerful. Direct deploying a program from Visual Studio to this little guy and seeing it light up and project content to my HDMI monitor really makes it feel like I’m doing something tangible. I’ll be making a whole series of posts about cool things you can do with the Pi. If you have any ideas, send ’em over!

We’re going to cover a number of topics in this one, namely ‘how do I do ex’ questions. We’ll have two somewhat silly examples to start, followed by an actually useful GUI to create a user to wrap us up here.

We’ll specifically be hitting all of these guys here, in order.

• Hide a UI Element (by special request)
• Use Checkboxes
• Use radio buttons (by special request)
• Populate a drop-down box automatically

Also, in a big departure from the past, I’ll not be posting full code on here anymore. From now on, code samples from here will always be linked and kept up-to-date on GitHub. You can find the code from this post here:

Alright, let’s get started. Power up Visual Studio and create a new project, specify ‘WPF’ as your type in the search box.
Continue reading

Quick How-To: Add an image to your Raspberry Pi Windows App


This is part of the Learning Raspberry Pi Series here on Click the banner for more Raspberry Pi and Windows!

One of the first things you’ll want to do when you make a GUI to push out to your Raspberry Pi 2 with Windows 10 is to make a fancy smancy GUI. To do that, you’ll need an image!

Assuming you’ve followed the guide here to make your first HelloWorld app, you might want to add an image. This will be your first image embedded in a functional app, so you’d better make it a good one!

For me, the pursuit of a fine image is half of the fun. Most of the fun! I like to Google around for the best image, that perfect piece of clipart which accurately describes my project, inspires my end user and aligns our paradigms…and then discard it and pick a picture of a Fox or a Sky Bison (my wife and I are really enjoying Avatar the Last Airbender now!)

Now that I’ve got a folder of some high quality jpegs ready

high Quality Jpegs

Using the toolbox image control, you can draw the outline for an image to put it wherever you’d like and then you’ll get a…uh…

Wait, it’s an X, what gives?

Previously, we were using PowerShell implementing .net classes to draw WPF forms, meaning we could put together a GUI in real time using bits and pieces from all over our system, including files stored in relative paths.

Since we’re not dealing with the same sorts of apps we worked with before, we can’t just point to outside files anymore. We’re talking about compiled code now; we’ve gotta up our game, and that means including assets.

Give me the short answer

Fine, I’ll save you a ton of words here. If you want to include an image in your program, you’ll have to embed it as an asset. These things get embedded in your .exe/code when you compile and are the one true way to deliver resources within your code. It is possible to download your image when the tool runs…which is something I’ll cover later.

To embed an image, follow these instructions/gifs

Open Solution Explorer and click on the Assets Folder. Now, right click->Add->Add Existing Item.

Add Item
Pick your file.

Now click your image placeholder again and check out the dropdown box.


Success! Our image was included!

You’re now on your way to building beautiful and functional Windows 10 Raspberry Pi apps, like this one:

Uh...this doesn't look very functional Stephen
Uh…this doesn’t look very functional Stephen

Uh…that doesn’t look very functional Stephen…

Super-Fast walkthrough: running Win10 Preview on Raspberry Pi 2 and what’s it like


This is part of the Learning Raspberry Pi Series here on Click the banner for more Raspberry Pi and Windows!

If you’re like me, you got really excited to hear about the possibilities of running Windows 10 IoT preview on your Raspberry Pi 2.  I actually bought one just for a blog series on PowerShell and Raspberry Pi, so stay tuned for more!  Note: I did all of this while drinking some brewskies the other night.  If I can do it mildly intoxicated, then you can definitely do it sober.

What you’ll need

  • Laptop / Desktop running Windows 10 Preview, can’t be a VM as you’ll need hardware access
  • RaspBerry Pi 2:
    • Base model
    • Fancy Smancy kit – I bought this one.  You’ll really want to put a heat sink on the CPU and GPU, this thing gets super hot.  This kit includes it.
  • 8 GB or higher Class 10 Micro SD Card.  Don’t buy an off-brand or you’re begging for pain!
  • Sign-up for the Windows Connect Program here and click through all of the EULAs to enable the download tab.  Download the .zip file and unzip it.
  • Optional : SD Card reader if you don’t have one

Continue reading

Windows 10 for Raspberry Pi – Solving DISM ‘the Drive can’t find the sector requested’


This is part of the Learning Raspberry Pi Series here on Click the banner for more Raspberry Pi and Windows!


You’re like me, and super excited to start playing with Windows 10 for the Internet of Things (IoT) on your Rasperry Pi 2.  But when running the DISM commands from this post, you see the following error:

The drive cannot find the sector requested
The drive cannot find the sector requested


This is sort of a very opaque error, and in this case, double-check that you’re using a big enough SD card.  As it turns out, I accidentally picked up a 4 GB card, which is too small!  I think the specific cause of this error comes from the fact that the image in question won’t actually fit on a card smaller than 8 GB, and thus the Deployment Image Servicing Management tool craps out trying to write to that sector.


Buy a bigger SD Card!  Here’s one which will work perfectly!  When you’re buying a Micro SD card, don’t cheap out.  The quality matters and the class (the bin rate) of the card definitely matters.  Smaller cards are virtually identical to the larger capacity SD cards and the only difference is physical imperfections in the card, which can mean an earlier fail rate and other problems.



Part II – Deploying PowerShell GUIs in Minutes using Visual Studio


This post is part of the Learning GUI Toolmaking Series, here on FoxDeploy. Click the banner to return to the series jump page!

I got a lot of feedback last time, everyone wants the rest of the series, and you guys want it now! So I’m skipping my normal 1,000 word limit for this post and making this bad-boy LONG! There will still be a part three where I’ll show you how to use some of the trickier form elements. Some of them are absolute hacks to make them work in PowerShell, so if you’re the god of XAML and WPF, please have mercy on us mere-mortals and add some comments to let us know how I ought to be doing it.

Let’s jump back in and take our finished XAMl from last time and put it into PowerShell.

Whoa whoa, what’s XAML

I don’t know if you noticed this window. This whole time we’ve been adding elements, dropping boxes and text and things like that, it’s been updating in real time!

Continue reading