tips word in wood type

In a previous post I mentioned I’m working on an app that plays videos. The app is pretty simple and fits a specific need I have. Once it’s in the Windows Store I’ll give the full details on it. In the meantime I want to share some tips and tricks I learn along the way that might help you with your app.

In the aforementioned previous post I showed you how I customized the appearance and behavior of the FileOpenPicker for picking only videos. Today’s tip has to do with how to get a bitmap image I can use in the UI of my Windows Store app from a file’s thumbnail. Essentially what I need to do in my app is have a small image of the video being played that I can display in an AppBar. Fortunately it’s pretty easy to do in a three step process:

  1. Get the thumbnail from a StorageFile
  2. Clone the stream of the thumbnail
  3. Create a new BitmapImage and set its source to the thumbnail’s cloned stream

Here’s the code:

Like I said, pretty easy! Hope it helps.

Weekly Windows 8 Office Hours

February 18, 2013

help_chalkboard

Next Monday Jeff Brand will be holding office hours from 1:00 PM to 3:00 PM at the Microsoft Store at the Mall of America. He will be there to help you take your Windows 8 app from an idea in your head to a killer app in the Windows Store. This isn’t anything formal you have to sign up for, there are no presentations, just feel free to drop by and chat.

If you’re the kind of person that needs to get this on your calendar or you won’t remember and/or show up, you can do so here.

The Microsoft Store is on level 1 of the Mall of America next to Lego, across from Guest Accessories. You can get more information on the store here.

You can see the full list of upcoming office hour events here.

What’s that you say? You haven’t even start writing your Windows 8 app? No worries! Here’s a couple of great resources to help you on your way:

  1. Download Visual Studio Express 2012 for Windows 8 – it’s free!
  2. Sign up for the 30 to Launch program for great tips and tricks
  3. Sign up for the XBOX Ultimate Experience contest as a little extra motivation to get you app in the store

Filtering the FileOpenPicker

February 15, 2013

tips word in wood type

I’m currently working on a Windows Store app that plays videos. I know you’re probably thinking, “Um, dude, there’s already an app for that called Video.” Yes, I know there is, but my app is for a very specific use case. I don’t want to share what that is until it’s in the store, so please be patient. However, I do want to share little tips and tricks I learn along the way that might help you in developing your Windows Store apps.

Similar to the Video app, I want users to be able to select which video they want to play within the app. Obviously this means I need to use the FileOpenPicker, but I want to do three things as part of the user experience with the FileOpenPicker:

  1. I want the FileOpenPicker to display thumbnails of files
  2. I want the FileOpenPicker to start in the user’s video library
  3. I want the FileOpenPicker to allow users to select only .mp4 and .wmv files.

A little trial and error along with some Bing-Fu led me to implementing this simple solution:

It works like a champ and meets my requirements. I hope it helps you.

tips word in wood type

One of the luxuries we as developers now have is the ability to pretty much assume that our users (and apps) will be connected to the Internet. Of course we need to plan for some offline scenarios, but for the most part we know a connection will be present. With that said, I believe we have a responsibility to our users to respect the type of connection they’re on. What do I mean by “type of connection”? I’m talking about the ability for a user to flag a connection as “Metered”. This allows the user to let apps know that “Hey, this connection is costing me money, please be careful if you happen to be using it.” For example, in my Radio Soma app I let the users select how they want the app to behave when a metered connection is in use via the following page:

image

In this case, when the user wants to stream music over a metered connection the app will prompt them first to confirm they want to continue streaming music. Users appreciate having this kind of control and it shows you’ve put some thought into your app and that you care about your user base.

Setting this type of functionality up is easy to do, so I thought I’d spend the remainder of this post showing you how I did it for Radio Soma.

The first thing I did was to create the following enumeration for potential connection state values:

Next I created a new class and added three events to it that can be fired when various connection changes occur:

I then added two fields to the class to keep track of the last know connection state and to provide access to roaming settings.

Following the fields I added three properties to the class. The first just me to use the class as a singleton; which is all that I need as I don’t require multiple instances of this class floating around in my application and causing chaos. The MeteredConnectionPrompt property is used to keep track of whether or not the user wants to be prompted when streaming music over a metered connection. Lastly, the IsConnected property lets the app know whether or not an internet connection is present. You’ll undoubtedly notice the empty catch{} block. I found that every now and then an exception would be thrown if a connection wasn’t present. I simply chose to bury the exception and return a value of false in this case. Not my proudest moment, but it works.

I needed a couple of methods for quickly accessing data stored in roaming settings. While I could have just used these inline in my Load() and Save() methods coming a little later, I prefer separate methods as it allows me to easily add and remove roaming settings within the class.

Next are the Load() and Save() methods which interact with roaming settings to retrieve and persist the value of the MeteredConnectionPrompt property.

Now comes the most important method, GetNetworkInformation(). In this method I determine if a connection is present, and, if so, what type of connection it is, raising the appropriate events along the way.

Finally, I add the constructor for the class. In this case it’s marked as private because I’m using the class as a singleton. I also have an event handler for the NetworkStatusChanged event from the NetworkInformation class.

You can view the full source here:

Spyhouse Office Hours

February 13, 2013

coffeeshop_coders

Just a reminder that next Wednesday I’ll be holding office hours from 11:00 AM to 1:00 PM at Spyhouse Coffee in Uptown. This

isn’t anything formal you have to sign up for, there are no presentations, just feel free to drop by and chat.

If you’re the kind of person that needs to get this on your calendar or you won’t remember and/or show up, you can do so here.

You can see my full list of Spyhouse Coffee office hours here.

I hope to see you there!

What’s that you say? You haven’t even start writing your Windows 8 app? No worries! Here’s a couple of great resources to help you on your way:

  1. Download Visual Studio Express 2012 for Windows 8 – it’s free!
  2. Sign up for the 30 to Launch program for great tips and tricks

What?

[Caveat: I am a Microsoft employee and fan. The thoughts and opinions expressed in this post are explicitly my own and not those of my employer.]

One of the challenges I think we all face as developers is figuring out which technology/framework/service to use on our projects. There are so many options it can be overwhelming a constantly leave you to second guess any decision you might make. If you’re writing apps you’re going to want your apps to run on as many platforms as possible and provide a consistent user experience on various platforms. You’ll also want to the ability to provide authentication and send out push notifications across various platforms as well. To make this happen you’re going to need a set of back end services and data. What are your options?

Well you could build out these services from scratch and host them yourself or with Azure or another cloud provider. But building and maintaining back end services is time consuming and not for the weak of heart. Especially when you have start thinking about things like availability, scalability, and security. Fortunately for you there are some providers that take care of writing the backend for you. This week I found out about one such provider popular with the local Android community called Parse. After an initial look at the service and doing some tire kicking it seems like a fairly decent service. The team at Parse has done a great job in providing a set of backend services for data, push notifications, social integration, and even some server side logic. They’ve also provided SDK’s for all platforms, including Windows 8 and Windows Phone 9.

The question I’ve been asking myself is “Would I use Parse over Azure Mobile Service?” As a huge backer of Azure and a Microsoft employee, you can probably guess my answer: No. However, I want to explain why I wouldn’t use it. Here’s why:

  • You can get to your data. Data stored in Mobile Services is stored in a SQL database and that database is YOUR database, you can use it for reporting, adhoc queries, BI, anything. You can back it up and take the data with you. You can even get to it through Excel. That data is stored in hot-swap triplicate at all times to handle hardware failures and provide high availability
  • Mobile Services are a part of Azure and are built directly on the infrastructure that supports Azure and Azure Websites
  • Azure has a presence around the world with a choice of datacenters (with more being added).
  • The ability to schedule recurring jobs that run in the background. (Read about it here).
  • Microsoft is not a startup. I know startups are all the rage, and there are some pretty amazing things in the startup space. With that said, if I’m creating an app, I have a hard time trusting my entire backend to a startup that may or may not be around in 6-12 months.

Keep in mind these are just my thoughts. Parse may be an ideal solution for you, but for me Azure Mobile Services is just a better fit.

If you want to learn more about Windows Azure Mobile Services, I encourage to visit the Dev Center to get started.

Weekly Windows 8 Office Hours

February 11, 2013

help_chalkboard

Next Monday I will be holding office hours from 1:00 PM to 3:00 PM at the Microsoft Store at the Mall of America. I will be there to help you take your Windows 8 app from an idea in your head to a killer app in the Windows Store. This isn’t anything formal you have to sign up for, there are no presentations, just feel free to drop by and chat.

If you’re the kind of person that needs to get this on your calendar or you won’t remember and/or show up, you can do so here.

The Microsoft Store is on level 1 of the Mall of America next to Lego, across from Guest Accessories. You can get more information on the store here.

You can see the full list of upcoming office hour events here.

What’s that you say? You haven’t even start writing your Windows 8 app? No worries! Here’s a couple of great resources to help you on your way:

  1. Download Visual Studio Express 2012 for Windows 8 – it’s free!
  2. Sign up for the 30 to Launch program for great tips and tricks
  3. Sign up for the XBOX Ultimate Experience contest as a little extra motivation to get you app in the store

Software programmer

OK, so maybe you’re not the guy in the picture above. You don’t eat, sleep, and breath code. (I can’t image such an existence, but to each his/her own.) But maybe you have a great idea for a Windows 8 and/or Windows Phone 8 game. You might think that your lack of programming experience is a barrier to getting your idea off the ground. You couldn’t be more wrong. You don’t need fancy tools like Visual Studio or knowledge of programming languages like C#, XAML, HTML, and JavaScript to create apps and games. There are a number of products on the market that hide all of this nastiness from you, and give you friendly interfaces for making apps and games. Here are some of the ones I’ve played around with that I’ll recommend to you:

YoYo Games

GameMaker Studio caters to entry-level novices and seasoned game development professionals equally, allowing them to create casual and social games for, iOS, Android, desktop and the Web (HTML5) in record time and at a fraction of the cost!

GameSalad

There’s no faster or easier way to develop games than with GameSalad Creator. Its visual, drag & drop interface and complex behavior library provide almost limitless freedom to game designers. Bring your work to life in hours and days instead of weeks and months. It’s all capable with GameSalad Creator!

Scirra

No programming required. Make your game do what it needs to do in a visual and human readable way with the powerful event system. There’s no need to memorize cryptic languages. Focus on what really matters: designing your game! It’s ideal for beginners, and powerful enough to let experts prototype faster than ever before.

TouchDevelop

TouchDevelop is a programming environment that runs on your mobile devices. You write scripts by tapping on the screen. You do not need a separate PC or keyboard. Scripts can perform various tasks similar to regular apps. Any TouchDevelop user can install, run, edit, and publish scripts. You can share your scripts with other people by publishing them to the TouchDevelop script bazaar, or by submitting them as an app to the Windows Store or Windows Phone Store.

If you need a little incentive to use one of these products and get your app done, I’ve got one for you. It’s actually not a little incentive, it’s a CRAZY I CAN’T BELIEVE THIS IS TRUE incentive. Here’s the deal:

genapp_ultimate_gaming-experience1[1]

First, you’ll need to register at http://aka.ms/getyourappon. Go do it now, I’ll wait. Really. I don’t mind.

Good, now that that’s done, you’ll just need to publish your app to the Windows Store and/or the Windows Phone Store by February 28, 203 to qualify for these SWEET rewards:

  1. A store registration reimbursement† AND a copy of Halo 4 for Xbox 360!
  2. A chance to win one of 12 Xbox 360 consoles with Kinect. The more apps you enter, the more chances you’ll have to win.
  3. The Grand Prize: Three devs with the best apps will win an ultimate backstage pass to Microsoft Studios and spend the day with the Windows 8 Games Studios team—makers of Windows 8, Windows Phone 8, and XBOX-enabled games!

Good luck!

Remember, if you get stuck and need some help I’m here for you. Just schedule some office hours time with me on my ohours site at http://ohours.org/codel8r.

tips word in wood type

I’m currently working on a Windows Store App that plays videos. One of the features I want in the app is the ability to right-click a video file in File Explorer and open it with my app. Similar to what you can do with the Video app today:

image

Doing so with a Windows Store app is very straightforward. Once you’ve create the app in Visual Studio, double click the Package.appxmanifest file in Solution Explorer.

image

Click the Declarations tab in the manifest and select File Type Associations from the Available Declarations drop down and click the Add button.

image

Now you’ll just need to set a few options and you’re good to go. In my case I added a logo that will display when the user right clicks a file and added wmv and mp4 as supported file types.

image

Once I deploy the application to my machine, I can right click on a wmv or mp4 file and see my app as an option for opening the file.

image

However, I’m not quite done. I need to give my app the ability to do something with the specific file when it’s opened in this manner. To do so, I start by opening the App.xaml.cs file from Solution Explorer.

image

I then override the OnFileActivated method and add my app specific code. In my case I just want to ensure a file has been selected, set an application level variable and navigate to the page for playing videos.

image

That’s all there is to it!

Spyhouse Office Hours

February 6, 2013

coffeeshop_coders

Just a reminder that next Wednesday I’ll be holding office hours from 11:00 AM to 1:00 PM at Spyhouse Coffee in Uptown. This

isn’t anything formal you have to sign up for, there are no presentations, just feel free to drop by and chat.

If you’re the kind of person that needs to get this on your calendar or you won’t remember and/or show up, you can do so here.

You can see my full list of Spyhouse Coffee office hours here.

I hope to see you there!

What’s that you say? You haven’t even start writing your Windows 8 app? No worries! Here’s a couple of great resources to help you on your way:

  1. Download Visual Studio Express 2012 for Windows 8 – it’s free!
  2. Sign up for the 30 to Launch program for great tips and tricks