PaceCalc for Windows Phone 7

As many of you know, I’ve been running for the last year and few months, and completed a few races here and there. One of the first things you start to focus on when you sign up for your first race is your pace and predicted finish time. It’s a simple calculation of pace = time / distance. You might be thinking, “wait, speed is distance / time”, but runners usually measure pace in minutes per mile or kilometer, rather than kilometers or miles per hour. So if you know the length of your race and how fast you can run, you can predict when you’ll come in. Or if you have a goal for when you want to come in, you can calculate how fast you need run to meet that goal. Last, and probably least, if you know how fast you’ll be going and how long you’ll be running, you can predict how far you will go.

There are pace calculators all over the web, but none yet for Windows Phone 7. So I figured it would be a fun project to create one. It would give me a real world reason to use some of what I’ve been learning about Silverlight too. On the outset, it looked really simple. Three text boxes for time, distance, and pace, and three buttons. The toughest part was all the time conversion and formatting. I decided to break up the text boxes for time into separate ones for hours minutes and seconds. I added some preset distance buttons and a toggle for miles or kilometers. Here’s the final result:

I’m really impressed with Silverlight. I’ve done enough Flex work so that this was quite simple. Flex has never really grown on me, but I find I’m actually starting to like Silverlight. It feels much more robust and mature and well thought out than Flex.

Anyway, the whole app took just a few hours to code. I started it when I got home from work on Tuesday and it was done before I went to bed. Wednesday morning I made up a crappy icon, took a screenshot and submitted it to the WP7 marketplace. Wednesday evening I got an email saying it was approved and the next morning (today) it was live and available for download. After having waits of up to 3 weeks for iOS app store approval, this blew my mind. Of course, the MS marketplace is young and lower traffic and will feel its own stress points as it grows. But I’m willing to bet that it remains a much more streamlined experience. Developers, developers, developers! Right?

I think this app will continue to be a great way for me to learn more about Silverlight and tweak things. I already worked a bit on input validation. When you enter an input field, a keyboard comes up just like on other devices. I had made it so that a telephone numeric keyboard comes up since you only enter numbers there. But there are still invalid characters that one could enter, such as “,+=#”, space, or “.” in the time fields. So I just did an update that restricts those characters and limits the number fields to two digits. I also started working on better layout using a few grids in key spots. I may even experiment with changing it to a panorama control, adding another page for maybe calculating splits (where you’d have to be at each mile or kilometer to be on track for your goal time), or other useful info.

Long and short of it, I’m having fun. The app is free by the way, so it’s totally for fun and learning, and of course because I find it a useful app personally. I’m also forming an idea for another game. Having fun is fun!

This entry was posted in Silverlight, Uncategorized, Windows Phone 7. Bookmark the permalink.

10 Responses to PaceCalc for Windows Phone 7

  1. Héctor says:

    I don’t find Silverlight (as a “framework on top” of .Net) more robust and mature than Flex, I don’t much work on either of them anyway, although I’ve read from a few people that do that Flex Spark components look better thought. I’m not much into RIA developing.

    On the other side, I find .Net better and more robust than AS, things like method overloading, private constructors, operator overloading, threading, etc should be present in the Flash platform as well. Well, we are getting a new compiler and threading in the near future, so we may get other improvements as well.

  2. todd says:

    have you ever done a prediction run? It is a unique type of race that is based on how well you can predict your time as opposed to how much faster you are than other runners. People get pretty close in their pace predictions based on how well they feel their workouts. Just wondering you ever did one, thanks for your blog posts and good luck with your running.

  3. Rob Toole says:

    After being highly resistant, I worked on a few Silverlight web apps over the Summer. Besides that awkward period you go through everytime you pick up a new code base, it wasn’t too bad save for a few simple features that were absurdly code heavy to get to work. As for workflow, obviously a lot of parallels with Flex dev. The best part is using VS instead of Eclipse. I’m trying to figure out if a WP7 phone is worth it or not, we’ll see.

    Still need to do the Meego version of Falling Balls for the Ovi store. Then you’ll have hit just about all of them.

  4. Héctor says:

    Yeah, I’m mainly a .Net developer, and VS is the best environment I’ve tried so far (not that I’ve tried so many tho… NetBeans, Eclipse, FlashDevelop, Bloodshed Dev-C++, plain text editors, and a couple more). Although I often find myself wondering if so much simplicity makes some people either more stupid, or think they are better developers than what they actually are.

    There are a few plugins for developing Flex apps inside Visual Studio, but never tested them.

  5. Robert says:

    Hi Keith,

    I left a similar comment earlier, but I didn’t know if it got lost in the shuffle or not. I’m a closet .Net fan who has been working with flash/flex for about 5 years. I keep trying to move to Silverlight. However, every time I do, I get annoyed because the binding in Silverlight doesn’t seem as easy to use or as powerful as flex. I’ve been reading your blog for a few years now, and I know you’re not a big flex fan. However, do you feel like you could jot down a quick comparison between binding in silverlight and flex? Or, did you attempt to use Silverlight’s binding features at all when building your app?


    • keith says:

      This was a simple project and I didn’t use any binding with it, so not really in a position to say. Any comparison I make between Flex and SL should be taken with the knowledge that I’m far from an expert in either one. Just an off the cuff observation but SL, being a sort of subset of WPF, which was designed from the ground up as a serious desktop and web application platform, with all the power of MS behind it, feels pretty solid, as compared to Flex, which is built on top of the already pretty quirky AS3 and Flash Player, feels hacked together in many areas.

      • keith says:

        And don’t take that as a hate on AS3 and Flash. Anyone knows I love the stuff, but you can’t deny that it’s quirky and hacky in many areas!

        • Robert says:

          Yeah, flash and flex have definitely had me scratching my head more than once (esp. when I venture into some parts of the flex framework source). That’s part of the reason I’m a .Net fan. I worked for a couple years doing backend data work in C# for my flash front and loved it. Microsoft is doing what Microsoft does best, copying the innovators and doing it better :).

          On the other hand, the flash platform always seems to be improving. As you know, the jump from AS2 to AS3 was enormous in reducing the amount of quirkiness. The latest improvements in the flash player runtime are certainly welcome as well. You definitely can build a solid application in a short amount of time with the right levels of knowledge about the runtime and tried and true programming principles.

        • Robert says:

          As an aside, I’ve just discovered that Cairngorm has been ported to Silverlight, so that may be an easy way for flexers to get into it.

  6. While you’re learning Silverlight you should check out Artefact Animator for time-based animations. It’s just like Tweener for Flash but works for Silverlight and WPF. The best thing about it is the fact that it wraps all the complicated code into an easy one-line solution and avoids storyboards altogether (for better or worse). Anyway, big fan of your work so I hope you enjoy.

    Happy New Years!

Leave a Reply