For the past 6 years, or just over 2300 days, I have had the incredible opportunity to work as a Technical Evangelist for Microsoft. And for all of those days, it was awesome. I spoke at over 150 conferences, organized 3 others, wrote over 500 articles on this website, published a book, created more than 25 apps, gained 20 pounds, drove over 50,000 miles, flew on over 120 airplanes, and most importantly, had the opportunity to meet and work with THOUSANDS of the most talented and passionate software developers anywhere. I couldn’t possibly list every single person that has had an impact on me both personally & professionally during this time. The developer community that I have been a part of for the last 7+ years is absolutely amazing.
Even something you enjoy this much has to come to an end at some point, and December 2 is that day for me.
I’m not leaving Microsoft, though. In fact, I’m moving to a new position, with a new set of challenges and adventures. I will be a Senior Program Manager in Worldwide DPE. The team is based in Redmond, Washington, but I have the good fortune to continue working from my home in Ohio. This means I can continue to participate in the developer community I’ve been a part of for so long.
In my new role, I will be working with several large ISVs (independent software vendors) who are building Windows Phone and Windows 8 applications. My job will be to help them architect, plan, build, and deliver their software to the market. This will include expanding my moderate knowledge of Windows Azure, and sharing my expertise of the Windows platforms with my customers and teammates. I’ll still be traveling from time to time, but I expect it to be less than what I am currently doing. I’ll still be writing articles, in fact I might even do another “31 Days” series again. We will see what kinds of things come to mind.
As I dive into this new gig on December 2nd, I’ll have more to share about what I’m learning, what the job is like, and all of the other random anger and curiosities you’ve come to expect from me. In the meantime, keep working on what you’re passionate about. Get started on that pet project, or just try learning a new language in 2014. Don’t wait to build something until you’re asked to. Invest in yourself. It pays huge dividends.
Finally, I need to help my almost-former team find a replacement. Ever considered a career in evangelism with Microsoft? Let me know. I’d be happy to pass your name on.
Over the past 6 months or so, I’ve been using Microsoft’s PubCenter to publish ads in my app, King Poker. It’s made me a decent amount of money (I’m averaging about $200/month right now). Three days ago, however, my revenue stopped, without explanation. I haven’t had much time to look into it, until today.
If you are using PubCenter, you need to update all of your existing Windows Phone Ad units by September 12th, or you will stop receiving ads.
In order to fix this, it’s pretty simple. Just go into your PubCenter account at http://pubcenter.microsoft.com, and update the app that each of your ad units is assigned to. (This might also be a great opportunity to update your categories, as each of them pays a different eCPM. There’s a great Windows Phone app, PubCenter Adviser, that will tell you, each day, which category is paying the highest eCPM.)
There’s an excellent blog post from the guys that run PubCenter explaining exactly what you need to do:
Remember, you need to do this by September 12, and this does NOT require any updates to your app, thankfully.
Today’s app review focuses on a developer that has already produced nine applications to the Windows and Windows Phone stores. Today, we are specifically going to look at her app, Armenian Alphabet.
The Armenian Alphabet app focuses on delivering a simple way to learn the shapes and sounds of the Armenian alphabet. Each letter is presented as a button (there’s 38 letters in this alphabet!), and diving into a letter will let you hear it spoken (by the developer herself!), as well as its usage in a common word, like “children”, or “electricity.”
As I think we will find with most of the apps that I will review, design could always be better, but it really is sufficient for the purpose of the app. You get a nice visualization of each of the letters, and a way to hear them pronounced. It does make me wonder if there is an “armenian alphabet song” that would put them all together like the English alphabet.
Even if you’re not interested in the Armenian language, download this app and give it a try. Developers can always use the feedback (you will leave a review, right?), and as a developer yourself, you might just learn something from the way she has put this simple, great idea together.
Lately, I’ve been working with a ton of developers that have published their first apps for Windows Phone or Windows 8. I thought it would be a good idea to start publicizing some of their efforts, and today, I’m starting with an app for Windows 8 called Car Records.
This app focuses specifically on answering one question: “What kind of gas mileage am I getting?”
With a very minimalist interface (there’s one button to record your fuel consumption, and one button to record your mileage), it effectively captures your data, shows you your differences in cost, MPG, miles, and uses some charts to show the highlights.
This app, like many in the Windows Store, has a great concept, but could use some work in the UI execution. While I like that I can easily enter this data and see simple reports on it, I feel like I am constantly flipping between the two views (Mileage and Fuel) to see the information I’ve entered.
I’d love to see a better use of the dashboard, with perhaps some “quick entry” dialogs that let me enter data without having to leave my reporting page. The charts would update live as the new data is entered. I’d also prefer to have a data view, so that if I make a mistake, I could just jump in and edit (or delete) an entry.
Overall, I love the concept, and I’d love to share your feedback with the developer as well. What do you love about this app? What would you improve? Download it and let me know.
I’ll publish another app tomorrow.
Almost two years ago (has it really been that long?) I wrote an article titled, “What’s In Your Laptop Bag?” It contained an exhaustive list of things I carry with me everywhere when I’m traveling to conferences or out-of-town meetings.
Today, I was looking around my home office and realized that it might be useful to do another one documenting all of the gear I have at my desk. (I work from home, so this is the dedicated space in my house where I work every day.) There’s another reason I’m writing this, though, and it’s because I received so many great responses and recommendations from the last article. I’d love to hear what’s important enough to keep on your desk, as well as your recommendations for the “weak spots” in my setup.
Let’s start with a picture (click to enlarge):
With the exception of the books on the bookshelves (though I might add a few of those as well), here’s the list:
When I decided to work from home 6 years ago, I decided to invest in a good chair. In my days working for advertising agencies, I had fallen in love with the comfort and durability of the Herman Miller Aeron Chair, and splurged on one for myself. No regrets whatsoever.
Under the chair, I started with plastic chair mats, but they ended up cracking and chipping away. I recently picked up an Anji Mountain Roll-Up Bamboo Chairmat, and couldn’t be happier. It’s gorgeous, durable, and is much easier to move than a giant plastic mat.
I’m currently using a Dell Studio XPS 8100 that I’ve had since March 2010. Three years is usually my limit on hardware, but I loaded this one up when I bought it, and it’s still going strong.
Here’s what Windows 8 thinks of my machine:
I’ve been running some kind of dual monitor setup for almost ten years now, so when I’m forced to just work on a laptop natively, it’s painful. That being said, monitors seem to last forever anymore, so I’ve had these two for 5-7 of those ten years. The first one is a Dell 2408WFPb 24” monitor. The second is a Dell E228WFPc 22” screen. I’ve held on to this smaller one for a while, only because it supports much higher resolutions than most of the monitors on the market right now.
I’ve also been using this for several years now (probably 4), and it’s on my list of things to replace. Not because it doesn’t work, because it’s excellent, but mostly because of the microphone. I’ve been doing more conference calls and podcasts, and it just picks up way too much ambient machine noise from around my desk. In general, however, it’s an excellent webcam for a reasonable price. This is the Microsoft Lifecam Cinema.
The Smart Card Reader
As part of the security measures at Microsoft, I need a smart card to access our internal network. The Omnikey 3021 Reader gets the job done, without being very large or inconvenient. It fits nicely under my primary monitor.
The USB Hubs
On each side of my monitors, I have installed in-desk USB hubs. Underneath the desk, they’re powered, and connected directly to the desktop machine. They’re only USB 2.0, but for everything I’m currently doing, I haven’t seen the need for USB 3.0 yet. There’s also space on either side of the ports to run cables through the desk. Excellent design. While this one is no longer manufactured, you can get the similar Belkin In-Desk USB Hub for about $35.
I am also running an iHome 7-port USB hub behind my monitors for the webcam, keyboard, smart card reader, and other USB accessories that find their way to my desk.
The Power and Networking Hub
I’ve also added a Sunway PowerTap into my desk’s surface. It adds three power outlets, and two wired network connections, making it easy to plug a machine in temporarily on my desk without having to run a bunch of wires underneath.
This is one of the most recent additions to my office, the Logitech Performance MX Mouse. I love it for several reasons. First, it’s very accurate. Some of the cheaper mice (even wired ones) that I’ve used in the past have been difficult to use for precision work like Photoshop. This is top-notch for that. Second, it is super comfortable in my hand. Finally, it has solved the problem that so many wireless mice in the past have been plagued with: it has a rechargable battery that can be charged while you’re using it. Just plug in a micro-USB cable to the front of it, and you’re back up and running. An exceptional mouse.
I have tried literally dozens of keyboards over the past few years, but none of them have justified the price. I’m actually still using the default keyboard that came with my desktop machine. It’s nothing fancy whatsoever, and I’m still looking for the keyboard that will change everything for me. Until that time, however, I’ll stick with the Dell SK-8165.
A few weeks ago, my headphones broke. They still worked, but the part that goes over the top of your head snapped, making them unusable. I spent a few weeks looking around for a replacement, and fell in love with the Beats by Dre Studio Over-Ear headphones. They’re the first noise-cancelling headphones I’ve ever owned, and the sound is excellent. (Not to mention they come in obnoxious colors, like the orange ones I got.) They also completely surround my ears, which means I can wear them all day without my ears starting to hurt from the pressure of them pressing down.
Sometimes, you want more than headphones can offer, and you want to listen to music without wearing headphones. For this, I’ve had a trusty set of speakers/subwoofer for years. They’re not for sale anymore (the speaker business seems to churn quickly), but the Creative Inspire 2.1 2400 are plenty to fill my office with enough sound to get my wife to knock on the door and tell me to turn it down.
The Audio Switch
Because this is my home office, and I’m super lazy and averse to wires laying everywhere, I’ve also grabbed an audio switch to jump back and forth between the headphones and the speakers. I actually mounted it right under my desk, so when I reach down to toggle the button on the switch, I feel like a Bond villain reaching to open the trap door. (OK, maybe not.) It also has a volume dial, so it’s easy to modify the volume of my system without having to jump to some menu on my system. One of the best purchases I have made for my office, and it only cost $15.
The Mobile Phone Stand
I do a bunch of mobile development, and in many cases, I need to test my software on a physical device. This little stand can often be found as a giveaway at conference sponsors booths, but you can also pick one up on Amazon if it works for you. It’s the Blue Lounge Milo Phone Stand. It uses “micro-suction” to adhere both to the desk and to your device, and it really works. When I was writing this section, it took me about 5 minutes to get it off of my desk. The only real downside to this stand is that my Nokia Lumia 920 needs to be plugged in to transfer my software to it, and the USB port on the phone is on the bottom. Getting it plugged in and sticking to this stand can be tricky, but it can be done.
The Desk Phone
Working from home, I don’t want to have to use my cell phone for all of my calls. (Yes, this means I still have a home phone number, don’t judge.) I wanted a phone that was cordless, took up minimal space, and offered a speakerphone function because I hate holding a phone to my ear. The VTech DS6321-3 DECT 6.0 Cordless Phone package did the trick. It comes with 3 handsets which don’t require a phone cord (except for the primary base, which is elsewhere in the house.) It has a tiny footprint on my desk, but gets a ton of use. It also has a nice feature (which I don’t use) that allows you to connect your mobile phone to the primary base via Bluetooth, so that when you’re home, you can answer your mobile phone from any of the handsets. It even uses a different ringtone, so you know which phone is ringing.
I seem to constantly need to scan in a business card, a signed document, or just a photo, and I don’t want to have to walk across my office to the big print/scan/fax/copy combo. I picked up the NeatReceipts Scanalizer Pro a few years ago to catch up on all of the business cards that were cluttering up my desk. It comes with some great software that does OCR, and imports that data directly into my Outlook contacts. Very convenient. It sits vertically on a stand behind my monitors, but is in easy reach when I need it.
As you can tell from the length of the list already, I have tons of cables on my desk, and I’d rather have none. To contain the chaos that is the wiring at my desk, I’ve been using Blue Lounge’s CableDrop cable clips. They’re adhesive, so they’ll stay where I want them to, and they grab and hold the cables I put in them. They’re great for keeping my keyboard wire in one place, my smart card reader in easy reach without moving all over the place, and even for running the wires directly under my desk instead of just hanging everywhere. Highly recommended. They come in a bunch of colors, but the ones I’ve been using are white, brown, and orange.
The “Other” Desktop
As I mentioned earlier, I do a bunch of mobile development, and this includes all of the platforms: Windows 8, Windows Phone, Android, and iOS. In order to build apps for iOS however, you actually need a Mac to do it. This is why I picked up a Mac Mini (with 8GB of RAM), which lives behind my monitors, and is a simple input toggle away. Visual Studio (with Xamarin) connects directly to it, which makes development a snap thus far.
Accessories for the Mac
I also picked up a Magic Mouse and Apple Wireless Keyboard for the Mac, mostly because they’re convenient, but also because I haven’t had much luck with KVM switches in the past, and for as rarely as I’ll actually need to use them, that seemed like significantly more work. They work great, but the Magic Mouse really doesn’t compare the mouse I’m currently using, and the keyboard is a little small for my everyday use.
The Surface RT
I’m accumulating quite the collection of tablet devices in this office, but there are three specifically that have a permanent place on the desk. First is the Microsoft Surface RT. I added the white Touch Cover, but mostly I use this device to test my Windows 8 apps that I’m building. Visual Studio can connect wirelessly to the device for debugging, so I never need to move it.
In addition to the Mac Mini, I also have an iPad with Retina Display. This serves several purposes for me. First, it has a retina screen, so I can see what my websites look like at this resolution. (Usually not great.) Second, I can deploy my iOS apps that I’m working on to this device for testing. Finally, as a dedicated Microsoft guy, it has become a research tool for me. I now have the ability to see what all the hype is about with certain apps I hear about that might only be available for iOS. So far, the apps have been the only differentiator from my Surface RT.
The Android Tablet
A mobile development environment wouldn’t be complete without an Android device, and while I acknowledge that there are literally hundreds of Android form factors out there, I picked the Google Nexus 10 32GB to be my reference device. Thus far, it’s been the tablet I’m least likely to pick up, but I’ve only had it for a few weeks, so time will tell.
The Tablet Stands
For the iPad and the Nexus, I wanted a simple way to make the accessible while charging. That’s where the Belkin FlipBlade comes in. It’s a strong but lightweight tablet stand that adjusts to several different angles. It also folds up flat for when you want to throw one in your laptop bag.
When I’m working from home, I rarely touch my laptop, but I’ve made a place at my desk for it simply so that I remember to update it, install software when I need it, and so it doesn’t just gather dust in my bag. This is the machine that goes everywhere with me on the road, however, so it needs to be up-to-date. This is the Lenovo X1 Carbon Touch.
The Laptop Stand
Finally, for the last item in the list, there’s the laptop stand. This is where my laptop lives when I’m home. I use the Griffin Elevator Laptop Stand because it creates a place my laptop should go, it’s beautiful, and it leaves plenty of space for things below it.
So that’s pretty much everything on my desk. At least, that’s everything related to technology that’s on my desk. I’d love to know what you’ve got on yours, and how it makes your work as a software developer easier. Link to your article in the comments, or just send me an email if you’d rather not share it with the world.
I’m a big believer that in order to be good at what you do, you need to pay attention to what everyone else is doing. For the longest time, I never understood why radio stations seem to interrupt you almost between every song with a reminder of which station you’re listening to. This becomes even more obvious when you’re listening to sports on the radio, and they specifically call it out:
“Let’s take a quick break for station identification on the Cleveland Indians Radio Network.”
Now, I understand that there is a law in place that actually requires radio stations to identify themselves, but I never really understood why. Last Thursday, Wil Wheaton posted an article similar to this one, reminding his subscriber readers who he is, and why you’re subscribed to him. In the same way that radio stations sometimes remind you who you’re listening to, I want to make sure you know there’s a real person behind this site, who cares about making this place a useful, informative, and reliable resource for software developers around the world.
You’re listening to Jeff Blankenburg. I’m a software developer, a dad, a husband, a golfer. I love board games (both making and playing them.) I love mobile computing. All flavors. I’ve published over 30 apps to various marketplaces. I play competitive volleyball at least once a week, and have been since high school.
I work for Microsoft as a Technical Evangelist. This means I spend my days educating myself and others about Microsoft’s development tools and technologies, with a specific focus on Windows 8, Windows Phone, and Azure applications. If you ever need any help, I hold virtual and in-person office hours every Thursday.
You can reach me just about anywhere, but here’s where I pay the most attention:
- Email: jeblank AT microsoft DOTCOM
- Twitter: @jeffblankenburg
- Blog: http://jeffblankenburg.com (but you probably already knew that)
- YouTube: http://youtube.com/jeffblankenburg
- LinkedIn: http://linkedin.com/in/jeffblankenburg
- GitHub: http://github.com/jeffblankenburg
Thanks for reading my articles. Your feedback and questions are what keep this thing going.
Yesterday ended my first month of being an active Windows 8 app publisher. The way I define “active” is that I have been consistently working to improve it since its launch. There are many apps that are thrown into any marketplace, never to see an update of any kind. In the first month, I shipped EIGHT updates.
Mind you, the first couple of updates were meant to solve two specific problems:
1) Address a couple of small bugs I had identified.
2) Get the Microsoft Advertising Control to actually work in my app.
Every app is going to have a bug or two, and there’s nothing terribly interesting about those, but the ads WERE tricky. I created my ad units at PubCenter (which as it turns out, is not a place to find a frosty pint.) I added an AdControl to the pages of my app using the identifiers from my ad units. But they didn’t show up in my app when I published it. In fact, after I published the first time, they didn’t show up in my development environment anymore either.
Being Lazy Was a Problem
I opened a support ticket with PubCenter, and after a couple of days of trading emails and eliminating the obvious problems, they simply asked to see my code, if possible. I pointed them to my github repository, where they identified that I had turned off “Internet” capabilities, and the AdControl needs this to serve ads.
Looking back, this is one of the most obvious statements I have ever written.
At the time, however, I seemed to me that the AdControl would probably have its own mechanisms for serving ads, and that they weren’t dependent on my app’s settings. WRONG.
Anyways, once I flipped that switch on March 8th, the ads started showing up, and much to my surprise, I started making a little money.
Let’s Define “Making Money”
In the first few days after the ads started working, I averaged about $1.30 a day. Not retirement money by any means, but my expectations were in the pennies a day range. A dollar or more seemed HUGE. Here’s a chart of my first month:
As you can see, March 18th was a huge day, grabbing me $4.55 that day. I thought this thing was just going to take off. As it turns out, that was my first day in the “New & Rising” category, and the shine slowly faded on that $4+ day. Regardless, I’ve been consistently averaging more than $2 a day, which would be over $700 annually. Not a fortune, but now I’ve got a baseline to start from, and I’ve got big plans to elevate that number over time.
What About eCPM?
The important number in the mobile app game is something called eCPM. If you haven’t seen this term before, everyone uses is, but nobody really seems to define it. eCPM means “effective cost per thousand impressions.”
In simpler terms, this breaks down to the amount of money you made for every 1,000 times an ad was shown. For the month of March 2013, my eCPM fluctuated as I was adding users, and ended up at an average of $0.73. This number seemed a little low, until I looked at where I’m hovering each day lately:
Day to day, I’m averaging about $2.30 for my eCPM. Since I’m averaging around 1,000 impressions per day, it makes sense that I’d be making about $2.00 a day. (I’ve had peaks of 5,000+ impressions in a day, but lately it’s been more in-line with 1,000 per day.
So What’s Next?
My plans for the future are pretty simple: drive more impressions per day. One idea I have for this is to offer a prize to users who hit a royal flush in the game. This should incentivize people to play more, in the hopes they’ll win the prize. I need to determine whether or not this is really legal, as well as whether or not it’s permitted in the Windows Store.
Another one is to make it more simple, and just reward those players that play more than a specific number of video poker hands each month. Something like 10,000 hands.
In either case, I’m looking for ways to get more players to play more often, to drive up the number of impressions I’m getting each day, which should also drive up the amount of money I’m making each day.
I’ll keep you posted on how this all works out.
Let’s say, hypothetically, that you had created a game that simulated video poker. Users can download the app for free, and they play with free credits that can’t be purchased in any way, nor can they be cashed in for anything at all.
Is that gambling?
Let’s now say, hypothetically, that in this video poker app, you created an offer to all of your users to award the first person each month that achieves a ROYAL FLUSH a prize of a giant, stuffed teddy bear. The users still risk none of their own money, but playing the game “might” win them the prize.
Is that gambling?
Now let’s swap out that teddy bear for a $100 gift card. Does that change anything?
Now is it gambling?
I’m considering this approach with my app, to encourage more people to play more often, but I also am jail-averse. I’m also massive-fine-averse. But to me, this seems about as cut and dried as it can get. How could it possibly be gambling if the player never risks anything?
Please leave your thoughts in the comments. I am sincerely interested in your opinions, and if you know a lawyer that has any insight into this, I’d love a chance to chat with them.
In general, my app is pretty straightforward. It’s a video poker application designed to look as similar to the real video poker machines in casinos as it can. Last week, I got ambitious, and decided to add some functionality that goes above and beyond the core functionality you’d expect.
I added Azure Mobile Services, and if the user was online, every single hand was recorded to my cloud storage database. In the 10 days it’s been live, I’ve recorded over 45,000 random hands of video poker to my database.
In addition, I added Microsoft Account authentication, which means that if you log in with your Microsoft credentials, I could persist your credit count and hand history across all of your devices. This is where the story gets ugly.
I spent HOURS writing and testing this functionality. Log in on my Surface RT. Play some hands of Deuces Wild. Log out. Keep playing. Log in. Play some more. Cut the wi-fi connection. Play some more. Reconnect. Sync the hands that were played when disconnected. Log in to the Windows Phone 8 version. See the identical credit count. If you were logged in to these apps, everything worked marvelously.
When you weren’t logged in, it still worked marvelously. It still logged your hands in my cloud database. My mistake was that I didn’t notice that even when you were logged out, it was trying to sync your credits. Anonymously.
So I pushed this new update chock full of new features to the store. And it passed. I was so excited! And then the negative reviews started flowing in.
“Used to work well on RT. Last update broke it. Lost all my money, well pretend money anyway. Please fix it”
“This is a great poker game. Play it all the time. However installed update yesterday and now it crashes all the time.”
“Credit counter still going crazy...Change the word HELD...back to HOLD, like in Vegas and Atlantic city...”
As it turns out, everyone that wasn’t logged in was synching their credits with everyone else that wasn’t logged in. Ouch.
I’ve been really careful about thorough manual testing, as well as running a full suite of unit tests, but this one got by me. I was so focused on what the experience was like for authenticated users, I didn’t give enough to time to think through all of the scenarios for those people that chose not to authenticate.
I fixed it immediately, but it was Friday night, and the Windows Store team doesn’t approve apps on the weekends. It wasn’t until Monday afternoon that my new patch was finally released, and almost immediately, I found yet another issue. (It’s funny how much more obvious bugs are when they’re in production vs. development.) I now have to wait at least another day before this issue will finally be solved.
Take Your Time
My point in all of this is to take your time. I was so anxious to get my new set of features into the hands of my users, I completely neglected to remember that apps that have to go through stores are SIGNIFICANTLY harder to fix than a simple website. If I find an issue on my website, I can fix it instantly. In your app, your users may have to suffer through days or bugs before you’re able to fix an issue. Take your time, get it right, and give your users the experience they deserve. It’s the only way you’re going to get MORE users.
In short, no matter how great your set of features is, a little extra diligence to think through ALL of the user scenarios will benefit everyone in the long run. That’s how you build a great app. Keep your users’ confidence high, and give them a reason to tell their friends about it.
If you’d like to
It would appear I’m going to start pumping out little “lessons learned” articles over the next few weeks, as I’ve learned an absolute TON from building my King Poker app. Today’s lesson is about capturing keystrokes.
Many of you have probably done this before: you want to recognize a specific key that has been pressed when a user is entering something into a TextBox. Maybe you want to take action when they press the Enter key, for example. This is generally simple enough, you just set up a KeyDown (or KeyUp, depending on your needs) event on the TextBox in question, and then just check every time the event fires until you find the key you’re looking for.
That’s not what I wanted to do.
To give you some context, here’s a screenshot of my app:
For the cards in question, I want to hold the three Queens, and then re-deal, hoping to get the 4th Queen, or maybe one of the Wild Deuces. (If I’m very lucky, BOTH!)
As the game currently stands, it is designed for use on a touch screen or with a mouse. Clicking/tapping on a card will mark it as “HELD,” and won’t replace it when you click the “DEAL” button. But you have to actually move your fingers or mouse to each card to mark them. For speed players, they’d prefer physical buttons that can be pressed over having to touch a screen.
This is where my key capture needs come in.
I don’t have a control that I can just drop a KeyDown event on. I want to be able to monitor keystrokes at all times. For this, we can simply wire up an event in the code-behind file, and capture it there. Here’s what it looks like:
protected override void OnNavigatedTo(NavigationEventArgs e)
Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown;
void CoreWindow_KeyDown(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.KeyEventArgs args)
if (HoldRound) HoldCard(Card0);
if (HoldRound) HoldCard(Card4);
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
Window.Current.CoreWindow.KeyDown -= CoreWindow_KeyDown;
As you can see above, I subscribe to the Window.Current.CoreWindow.KeyDown event, which fires before anything else gets access to the key event. This is also a great way to capture keystrokes before they get to your TextBox controls, etc.
Once I’ve got this event rigged up (and un-rigged it with my OnNavigatingFrom event), I can now easily provide physical keys for my power users by enabling the #1 - #5 keys to hold the cards rather than having to move their mouse all over the screen. In addition, I’ve also set the Spacebar up to provide “Deal” functionality, which means they never need the mouse once they start playing the game. Here’s a look at the cards held:
And finally, in case you were wondering, here’s what I drew (I got that wild 2) to get my four of a kind!
So there you have it. A simple way to capture keystrokes in C# and XAML applications for Windows 8/Windows RT applications. Many apps have a need for this in some way (even if it’s to provide a shortcut or even an Easter Egg), so consider this in your applications as well.