Retrieving more data from Azure Mobile Services using paging and LoadAllAsync extension

Azure Mobile Services allow you to take 50 records at a time by default, or 1000 records at maximum. What if you have more records and want to retrieve the entire table? I just created this beautiful extension method to help you get any amount of data you want, given any page size you want. This simple call to LoadAllAsync will asynchronously load ALL data from a WAMS table in pages of 1000 (or whatever number you specify) records (may also be good for bandwidth reasons):

var updatedReports = await azureTable.Where(r => r.complete == true).LoadAllAsync();

And this is an extension method, which elegantly does exactly what it says: loads all data. Enjoy:

        public async static Task<List<T>> LoadAllAsync<T>(this MobileServiceTableQuery<T> table, int bufferSize = 1000)
            var query = table.IncludeTotalCount();
            var results = await query.ToEnumerableAsync();
            long count = ((ITotalCountProvider)results).TotalCount;
            if (results != null && count > 0)
                var updates = new List<T>();
                while (updates.Count < count)

                    var next = await query.Skip(updates.Count).Take(bufferSize).ToListAsync();
                return updates;

            return null;

Making $30,000 a month on Windows 8 apps

When I started this project, I never thought about making any money at all: this is my hobby, what I like doing on the weekends and nights, when I’m away from my everyday business. Someone likes ping-pong or dancing, I like building apps and skiing.

I built several apps close to launch of Windows 8, including Card Games Chest , and is the first six months since Windows 8 launch apps my apps generated around $100,000 in ad revenue and sales (in-app purchase and ads, apps are free).

This post is NOT about how to get rich fast: I spent many nights and weekends, polishing the code, staying up late at night until 2AM coding. This is not easy: to build apps that can be used by half a million people from many different countries. I read all reviews, thousands of them, answered thousands of questions, made hundreds of improvements suggested by users to achieve this result. The truth is: any app reaching this stage is a work of art, it requires a lot of work, patience, time and dedication.

This is simply my account of what an individual developer can achieve in Windows ecosystem in just about 6 months.  I build everything: code, graphics, artwork, database, Azure backend. Everything.

If you are looking for code samples, this post is mostly about a story, but I posted quite a bit of code samples in this book, and my blog, and actually Microsoft documentation is very good, so if you are interested in the code please go there and you’ll find it.

D-Day, October 26th


The days following October 26th (the release date of Windows 8) were a little bit of a shock to me (in a good, positive sense). What happened after October 26th is best illustrated on this hockey-stick chart, since then the total number of downloads rapidly reached half a million and keeps growing.

My regular job keeps me pretty busy, and oftentimes I didn’t have enough time to check the revenue, but in a couple of months following October 26th,  the numbers really started to grow, and finally reached the point when I decided to share the story, because I think that this is the “magic” moment for all Windows developers. Right now it is, and I hope that if you read this post, it’ll keep you motivated and you’ll know that this can happen, can happen to the app that you can build, providing it’s a good high quality product.

So, October 26th was the D-Day for all developers who believed in Windows ecosystem. If you want to time the market, the time-count started on October 26th, 2012. The 1+ billion strong ecosystem of Windows users opened doors for apps, and opened it quite literally by opening stores on millions of devices. And it worked!

Windows Store: Developer Prospective

What to expect from the Windows Store? The Windows Store helps you build, deploy, distribute, and sell your Windows 8 apps and in-app products. As a developer, you also have the option to monetize your app through ad revenue using the Microsoft Advertising SDK for Windows 8 (as I have in my apps!). Integrating the SDK into your app is quick and easy to do – with a few lines of code, you can quickly get ads being served in your app in a non-intrusive manner.

On the paid apps and in-app purchases side, one significant advantage of the Windows Store, compared to the Apple or Google stores, is that your revenue share actually increases, as you make more sales. You take home 70%, and Microsoft commission is 30%, same as Apple or Google, but once your app starts making $25,000 in revenue, you take home 80%. As your app scales, you can expect to take home more, for example on a $1 million revenue, you’ll be taking home $97K more in revenue than your Apple or Google competitors. As a developer I like that.

The Windows Store API is very well documented and allows you to implement any type of business model: free, to pay-per-download, trial, in-app purchases and even subscriptions (by using ExpirationDate for example. In addition, you can use Microsoft Advertising SDK to monetize ads.

Revenue Split: Ads vs In-App Purchase

I’m often asked the question: what percentage of revenue is made from ads vs. in-app purchases. The answer is: that number changes greatly with the number of downloads, you may need to adjust your pricing model several times as your app begins to grow, so be prepared to update your app. Any answer I give you is meaningless, because it depends at least: a) on how good is your app b) how many downloads you have c) how long users stay in your app. I’m sure there’s half a dozen other variable to that equation.  When I passed half a million downloads, the ad revenue increased, but that depends on the nature of the app and volume. The ultimate formula is a black box for developers, and it better stays this way.

I don’t encourage you to start searching for Philosopher’s stone to start making gold from nothing, and instead focus on the content and quality of your apps. No magic in the world will help you if consumers don’t like your app.

Pricing your app

Windows Store allows you to price the apps between $1.49 and $999.99. Finding a sweet-spot for your app is an art rather than science, it greatly depends on the type of the app you make. You can do a little price-sensitivity analysis as I illustrated in my book (Ch. 11) to find a sweet spot. This blog post doesn’t intend to go deep into pricing models, but just give you an idea of what kind of revenues are possible in Windows today.

Would anyone buy your app for $999.99? Maybe there’re a few apps that fit that business model, but generally the number of downloads would be fairly small, if any. So, finding a sweet sport for your apps is something you need to think about.

Selling your apps and products

So, for example you have a game. Games are typically trial enabled, and may have in-app purchases in them. What it means is, you can let your customer download the game for a limited period of time, and then ask them to pay. You can also include paid levels or products into your games, or consumable products spent while playing the game, for example magic items, credits or gold.

Certifying and Publishing your app

Before you publish your app, run it through the app certification kit. I have a monthly Webcast at Microsoft, that provides tips on app publishing and certification. I hope if you look though our events schedule, you can find it and listen to it. There’s a lot of useful information there if you want to submit your app and are curious about how to make this process nice and smooth. Overall, Windows Store is very good at detecting early problems and at the end you benefit as a developer: Microsoft helps you make your apps better.

Magic moment in Windows Store

When I presented to the largest iOS meetup in Silicon Valley, I asked the audience of 200 pro-iOS developers a simple question: do you believe as a new developer I can enter Apple Store market today with a bunch of Solitaire games and make this kind of money? Their response was: you’ll waste your time, the Apple Store market is too saturated! I think every market has its magic moment, and this time existed in Apple store a few years ago, maybe even Android store had it (maybe), but I think that this time is in Windows Store today, and I don’t need any further proof than my banking account to tell me where the wind is blowing.

Build for Windows? Build for Windows Phone

Windows Phone is a great companion device for your Windows 8 apps. I recently built a top app for Windows Phone as well, and I think every developer should consider both Windows 8 and Windows Phone, because they are also part of the ecosystem and augment each other. The apps are very easy to port from one system to another. While the namespaces are different, the code is mostly portable, first by using PCLs (Portable Code Libraries) and re-using most of the logic.

Where to start

Windows 8 is a fantastic operating system, fast, fluid, with beautiful modern design targeting both tablet and desktop, sensors, NFC support, amazing new concepts built into user interface both touch and desktop, and did I mention: it’s fast! I can also re-use most of my code for Windows Phone. The beauty of Windows is that it spans across all kinds of devices: from phones to tablets, to desktops, to servers and gaming consoles, such as XBOX.

Windows is very developer friendly. You have plenty of languages and modern technologies to choose from, and the development tools, Visual Studio and Blend are stunningly good! You can use JavaScript and HTML5, C#, XAML and .NET, or C++. You can also use many of the frameworks to build your apps, most of them support Windows.

Some developers ask me about the best PCs to choose: visit a Microsoft Store, check out some new models available there. I personally like convertibles, and the touch screen is highly recommended. There’re so many vendors, that it really becomes the choice of your lifestyle.

Monetizing Windows 8 apps: examples from my book

If you are looking for code examples for Professional Windows 8 Programming: Application Development with C# and XAML book, specifically for the monetization section, you can get them directly from Wiley:

Chapter 11 code for Pro Windows 8 Programming
563.02 KB
Click to Download

What I’ve done in that example is helping you put all monetization techniques together: from unlocking the trial, to using in-app purchase. There’re some neat ideas implemented with the example, for example I use an MVVM model to wrap store licensing schema.

I recommend reading the book first, about the ideas implemented here. This snippet illustrates the first technique of using an MVVM model to wrap the store objects. This may be necessary if you need to expose them later through data binding.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CatalogShoppingAppCS.Data;
using Windows.ApplicationModel.Core;
using Windows.ApplicationModel.Store;
using Windows.Foundation;
using Windows.UI.Core;

namespace CatalogShoppingAppCS
    public class AppLicenseDataModel : INotifyPropertyChanged
        public event PropertyChangedEventHandler PropertyChanged;

        private bool _licensed = false;
        private string _price;

        public AppLicenseDataModel()
            if (CurrentAppSimulator.LicenseInformation.IsTrial)
                CurrentAppSimulator.LicenseInformation.LicenseChanged += OnLicenseChanged;
                _licensed = true;

        private async void GetListingInformationAsync()
            var listing = await CurrentAppSimulator.LoadListingInformationAsync();
            _price = listing.FormattedPrice;

        private async void OnLicenseChanged()
            if (!CurrentAppSimulator.LicenseInformation.IsTrial)
                _licensed = true;
                CurrentAppSimulator.LicenseInformation.LicenseChanged -= OnLicenseChanged;

                // need this to the license change occurs on a different thread
                // to update UI bound elements from the data model
                CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    if (IsLicensed)
                        var groups = CatalogDataModel.GetGroups("AllGroups");
                        foreach (var group in groups)
                            foreach (var item in group.Items)
                                item.IsAdDisplayed = false;

                    if (PropertyChanged != null)
                        PropertyChanged(this, new PropertyChangedEventArgs(String.Empty));

        public bool IsLicensed
            get { return _licensed; }

        public bool IsTrial
            get { return !_licensed; }

        public string LicenseInfo
                if (!_licensed)
                    return "Trial Version";
                    return ("Valid until " + CurrentAppSimulator.LicenseInformation.ExpirationDate.LocalDateTime.ToString("dddd, MMMM d, yyyy"));

        public string FormattedPrice
                if (!String.IsNullOrEmpty(_price))
                    return "Upgrade to the full version for " + _price;
                    return "Upgrade to the full Version";

Professional Windows 8 Programming: Application Development with C# and XAML

Data, Files and Networking in Windows 8 apps: examples from my book

If you are looking for code examples for Professional Windows 8 Programming: Application Development with C# and XAML book, specifically for the section on handling data, files and networking, you can get them directly from Wiley:

Chapter 6 code for Pro Windows 8 Programming
11.23 MB
Click to Download

These examples include everything: from managing local and remote settings, to networking and proximity.

MarkedUp to Windows 8 apps is what Google Analytics is to Web sites

MarkedUp may become to Windows 8 apps what Google Analytics is to a large portion of the Web sites: an easy to add analytics solution that gives an insight developers need for their Windows 8 apps. I’d like to quote MarkedUp Web site to explain their solution goals in their own words:

MarkedUp is an analytic and logging service built from the ground up to support Windows 8 apps (also known as metro-style apps) in the WinRT environment. Designed to be usable across all of the supported WinRT language from JavaScript to C# to C++ the client SDK allows you to capture analytics and diagnostic logging no matter your preference in development language.

If you want a quick overview on how MarkedUp works and how to install it into your Windows 8 apps, check out our MarkedUp tutorial video.

Continue reading “MarkedUp to Windows 8 apps is what Google Analytics is to Web sites”

Ready to make some money, Windows 8 is coming!

This weekend I invite you to my session at Silicon Valley Code Camp 2012:

We’ll discuss Windows 8 Store, monetization and… a bit of a surprise: for the first time I’ll be announcing my book Professional Windows 8 Programming: Application Development with C# and XAML
, written with a great team of authors: Nick Lecrenski, Doug Holland, Allen Sanders, Kevin Ashley. At this session we’ll focus on practical aspects of monetizing Windows 8 apps. I’ll share some code examples, including: in-app purchase, trial unlocking, placing ads in the apps and using trial model to support monetization. We’ll also touch on more advanced topics, and as an author of several apps in Windows Store, I’ll be happy to answer your questions.

Windows 7 sold over 500 million copies in just three years, if Windows 8 does that well this is going to be one of the biggest opportunities our industry has ever seen. Come learn how to get your app into the Windows Store and how to make money. After all, you want to be the first app in the marketplace and have the early mover advantage, don’t you?

SESSION CODE EXAMPLES INCLUDE: Trial, in-app purchases, store simulation.

1:45 on Saturday

Foothill College
12345 El Monte Road
Los Altos Hills, CA 94022

Windows 8 for iOS Developers (Part I)

I happened to attend a weekly class by Joe Conway, the author of iOS Programming “The Big Nerd Ranch Guide”. The class covered ObjectiveC and iOS development, but today I’d like to talk about what wasn’t covered in this class: mainly discuss how can an iOS/Apple developer get into Windows 8 world, and what are the differences between iOS and Windows 8 development from the programmer’s prospective. Especially, this post is for Apple iOS developers: it may sound strange, but despite the obvious differences between the platforms, you’ll easily find ways of doing familiar tasks in Windows 8.

I have to admit that Joe’s task was daunting, but Joe handled it brilliantly. With about 20 Microsoft developers in the audience he had to give an ObjectiveC iOS class. The great news for iOS developers: by learning Windows you will actually advance in your computer science class, and may be even by a lot! As Joe put it: there’re two sides of the spectrum: one is people who ask me to fix syntax errors, another is you guys with “why can’t you do it that way”? With Windows some relatively hard tasks become easy and possible: editing animations, asynchronous programming, neat process management, I hope these topics will be interesting for you. This won’t be a side-by-side comparison, instead I’ll focus on helping developers move from iOS to Windows and learn something new along the way.

Continue reading “Windows 8 for iOS Developers (Part I)”

My apps included with Windows 8 Release Preview

My apps included with Windows 8 Release Preview Store

What a day! Windows 8 Release Preview is released today! And after weekends and nights of coding, my modest contribution to all that Windows glory is now available for your gaming pleasure! The app is called “Card Games Chest” and you can download it from the Store, on any Windows 8 Release Preview tablet, or PC, so go get it now! It’s free as in beer.

Continue reading “My apps included with Windows 8 Release Preview”

Shockingly good video calls from Windows Phone

P1050780_thumbI have to admit that I experienced a discovery and an emotional shock not dissimilar from those experienced by people who saw Morse or Marconi devices for the first time, and this is what my post is about. This weekend Skype for Windows Phone has been released to all Windows Phone users, and I happened to be closing 2011-2012 skiing season in Kirkwood, CA. It has been a great season, by the way, as I mentioned earlier in my other Windows Phone skiing posts Smile on ski apps available now from the Marketplace.

It’s worth mentioning that Kirkwood Mountain has a great AT&T 4G coverage. I suspect that this is because they have a couple of transmitters right on top of the Wall chairlift, at least they look like cell towers of some sort. Skype

When I mentioned that my emotional shock from using Skype while skiing was of the same kind experienced by first Morse and Marconi device users, I was completely honest.

It’s Tuesday, a couple of days have passed, and I still feel that it’s the beginning of a completely new era in ski gadgets. It seems with Skype for Windows Phone you can now literally be out there with your friends and family real-time!

Continue reading “Shockingly good video calls from Windows Phone”

Re-imagining app development: Introducing Windows 8 at Microsoft Silicon Valley campus, April 4th


Are you interested in experiencing the next great app platform opportunity, Windows 8? Do you want to learn how to get started building apps for this new platform?

We are inviting the Silicon Valley startup community to a full-day, knockout, deep dive event taking place on our Silicon Valley Campus. Developers and designers alike will take the stage to show you how to take advantage of this new platform opportunity. Several startups will demo their brand new apps and talk about their early experiences developing for Windows 8, while the Microsoft team will provide attendees the opportunity to play with the platform and the tools needed to get started. Sessions will cover designing for the new Metro UI, building for the platform, and monetizing your apps.

Continue reading “Re-imagining app development: Introducing Windows 8 at Microsoft Silicon Valley campus, April 4th”