Nick's .NET Travels

Continually looking for the yellow brick road so I can catch me a wizard....

Sochi Apps for Windows Phone but not Windows

The Unwired has a good summary of the two Windows Phone applications covering the Sochi winter Olympics. I had already downloaded them yesterday and must admit I was quite impressed with the attention to details. The apps are clean and responsive – of course, I reserve the right to change this opinion when the event actually starts and I want to see actual results and to be notified when events are on.

I just took a quick look on the Windows Store but alas there are no official applications there. There are a couple of third party applications but no official ones.

Building Charming Apps for Windows and Windows Phone

Fellow MVP and owner of In the Hand, Peter Foot has published a number of helper classes for developers targeting both Windows and Windows Phone. I particularly love that these enable developers to “build charming apps!”

Charming ApplicationModel
Charming Display
Charming NFC Share
Charming Popups
Charming Search
Charming Settings
Charming Share
Charming Storage

Get them directly from NuGet or visit the CodePlex site for more information.

http://charming.codeplex.com/

Aligning Characters and Spacing in Windows 8.1

When designing applications for Windows Phone we spend a lot of time aligning the left edge of virtually everything to either each other or to the imaginary grid drawn over the page. Unfortunately the SDK doesn’t make life easy for us as the TextBlock element doesn’t automatically trim white space on the left of the contents. The net effect is illustrated in the left of the following image where the “a” and “b” aren’t left aligned, despite being offset by exactly the same amount from the left edge of the page.

image

Windows 8.1 includes the OpticalMarginAlignment property which you can set to TrimSideBearings in order to remove excess whitespace. The net effect is shown in the right side of the image where the “a” and “b” are now left aligned.

Intercepting DataContext Change in Windows and Windows Phone

Often when working with UserControls you need to wire/unwire logic when the DataContext of the control changes (eg it’s used on a page and the viewmodel which is bound to the page flows into the UserControl as the DataContext). Unfortunately prior to Windows 8.1 there wasn’t an easy way to do this. In Windows 8.1 you can do the following in order to hook up to the DataContextChanged event handler

public class TestControl : UserControl
{
    public TestControl()
    {
        DataContextChanged += TestControl_DataContextChanged;
    }

    void TestControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
    {
        // Do stuff with the new Data Context
    }
}

So, how would you do this prior to Windows 8.1 and for Windows Phone? Well, one option, and I’m not saying this is the only option, is to create a different dependency property and connect it using data binding. For example:

public class TestControl : UserControl

   public object CustomDataContext
    {
        get { return GetValue(CustomDataContextProperty); }
        set { SetValue(CustomDataContextProperty, value); }
    }

   public static readonly DependencyProperty CustomDataContextProperty =
        DependencyProperty.Register("CustomDataContext", typeof(object), typeof(TestControl), new PropertyMetadata(null,DataContextChanged));

    private static void DataContextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        // Do stuff with the new Data Context
    }
}

And when you use this control, you’ll need to data bind to the CustomDataContext property:

<local:TestControl CustomDataContext="{Binding}"/>

The “{Binding}” without a path simply means that the current DataContext for the control will be passed in. You’re then free to do whatever you want with the real DataContext as you can be assured it would have been set at this point.

Organisations that discard TFS in favour of Git are throwing out the baby with the bath water.

A number of clients that I’ve worked with over the past couple of years have made the decision to abandon their internally hosted Team Foundation Server (TFS) in favour of a Git. Some have decided that they’re going to host their own Git repository; others use it in the cloud. Unfortunately most of them have been suckered into using Git without understanding what they do or don’t get as part of the package.

The first thing to observe is that the first couple of versions of TFS were a nightmare as they were overly complex to setup and even worse to manage. Luckily I was never game enough to go down that path as at the time I was working of an instance of SVN running on a VM with 500MG of RAM  on a Mini-PC box sitting under my desk (and btw it ran like a dream with checkins taking fractions of a second even from the other side of the planet). Unfortunately some organisations spent years fighting TFS handing it off to traditional ops people and expecting them to know how to manage it.

For a lot of developers the two step checkin process of committing locally and then pushing to a repository is just a waste of cycles and they won’t get much benefit from the peer-to-peer nature of Git. Those passionate about Git will argue that this is because they haven’t invested enough time into Git to learn how to use it to its full extent. I’d counter this by indicating that if you’re spending that long working with Git, then you’re not writing enough code and that your process is broken (most likely checking in too infrequently resulting in lots of large merges). My early arguments against Git were that it was unnecessarily complex as everything had to be done via a command line – really, really really, in this day in age, we have to use a command line to do checkins??? Luckily there are now several UI alternatives available for those who don’t want to see a command prompt.

With these points aside (this isn’t a post on why you should/shouldn’t use Git) it’s important to recognise that Git is really only about source control; source control makes up a very small, yet integrated, part of TFS. Particularly with the move to the cloud (check out http://visualstudio.com) TFS has undergone a transformation with new features rolling out hot of the press. Not only does it do source control, it also does task and iteration management, build automation, testing, and even team rooms for conversing with remote team members on a project. All of which are integrated so you can see what code was written to fix a bug, who broke the build and what they changed, and even get notification in the team room when a build has succeeded. This level of integration is completely missing from Git.

So you have to wonder, if these organisations are not using TFS, what do they use as a replacement for managing projects. The answer is a sad combination of email and disparate tools kit bootcamp and jira. The lack of integration means that requirements, tasks and bugs are often loss into the email abyss; code is modified and no-one knows who or why the changes were made and builds either don’t exist or are managed completely independently. Of course, in some cases someone in the team realises theses pieces of software aren’t working together, so they cobble together an integration piece which is so brittle that the build breaks more frequently because of their patchwork solution, than it does because someone legitimately broke the build.

The upshot of all this is that if you haven’t tried Visual Studio Online, I’d suggest now is the right time to take another look at TFS. Sign up, and I’m sure you’ll be pleasantly surprised….. oh, and did I mention you can opt to use Git for you source code!

Data Exchange for Application Extensibility on Windows Phone and Windows

Both Windows and Windows Phone support launching applications based on file extensions or via a custom uri protocol. This is the equivalent of “open in” capability that other platforms have and it is a fundamental mechanism for sharing data from one application to another. For example you might have a dropbox application which can list various files but doesn’t provide a mechanism for opening or editing all possible file types. Instead when a user clicks on a file to open it, the application can simply attempt to launch the file, allowing the platform to pass off the file to the appropriate application. This is implemented by taking a copy of the file and passing it to the destination app. Unfortunately this then means that the view/editing application can’t save it back to dropbox. The round-about way to save the changes is to then launch the file, this time with the file being picked up by dropbox.

What’s interesting is that this is expressly prohibited by the Windows Store App certification requirements. Point 3.1 states that applications can’t implement bi-directional data exchange:

image

My view is that this clause was written by a completely different team (probably a security “expert”) to the one that actually implemented file/uri handling and doesn’t really understand why they were implemented in the first place. In Windows you can implement Share contracts but this is not really a great way to data exchange between apps – it works well for “share to social” or similar scenarios. Take the Facebook Login for Windows Phone this uses bi-directional data flow to authenticate users via Facebook for applications wanting to connect to Facebook (similar to the way iOS works for Facebook auth). With the current Windows Store requirements I don’t see this as being possible.

 

References

Auto-launching apps using file and URI associations for Windows Phone 8

Auto-launching with file and URI associations Windows Store apps

Getting Started with Design for Windows, Windows Phone, iOS and Android

Here’s a summary of some of the design guidelines for the various mobile platforms:

Windows Phone
http://developer.windowsphone.com/en-us/design

Windows
http://msdn.microsoft.com/en-au/windows/apps/hh779072.aspx

Android
http://developer.android.com/design/index.html

iOS
https://developer.apple.com/library/ios/design/index.html

 

Another great resource on user experience design is the UX Mastery website

http://uxmastery.com/

In particular the book Everyday UX is worth purchasing:

http://uxmastery.com/everyday-ux-remarkable-people-telling-their-stories/

Much needed updates to the Windows Store

Just in case you missed the announcement regarding changes to the Windows Store: More control for app developers in the Windows Store

The main updates are

*    Setting your app’s release date and time
*    Managing your app’s availability
        - Temporarily removing the app from store
        - Support for Windows 8 (ie only show a Windows 8.1 listing)
*    Simplified certification requirements

RateMyApp Control for Windows Phone

Earlier this month I posted on how to Boosting Reviews of your Windows Phone Application using the MarketplaceReviewTask Launcher.

Across on the Nokia developer wiki there is an article talking about the RateMyApp component that is available for Windows Phone (http://developer.nokia.com/Resources/Library/Lumia/code-examples/rate-my-app.html). Essentially this makes the process of directing your users to rate and review your app after a number of application runs as simple as adding a NuGet package and adding a control to the main page of your application.

Here are a couple of pointers:

- DO make sure you call the Review method on the FeedbackHelper class rather than directing users via the MarketplaceReviewTask. Using this method makes sure they don’t see the RateMyApp prompt at a later stage.

- DO NOT use the standard prompts. It’s generally deemed to be bad practice to suggest what rating to give your app. You’re better of controlling when they see the rate/review prompt so that they’re more likely to give you a good rating when your app works for them.

Non-Blocking Initialization Code to run at Startup on Windows Phone

One of the challenges often faced by developers is that they have code that needs to run at startup. This code typically has to run before any page begins to load its content; it has to support deep - linking, so shouldn’t be page dependent; and should never block the UI (which if done for long enough would cause the app to crash). In this post I’ll show you one way to achieve this – I’m sure there are plenty of other options.

In the constructor for the application make a call to your initialization method. This initialization method will return almost instantaneously since it simply spawns another thread.

public App()
{
    // Standard init code for a Windows Phone app ...

    // This can be called here since all it does is pass off to another thread for the long running tasks to run.
    // If this code requires the app to be further in the lifecycle, then you may need to
    // move to launching/activating event handlers
    InitCodeThatTakeAWhile();

}

And now for the initialization method. As mentioned, the first thing it does is to spawn another thread using Task.Run. Despite warnings from Resharper we do not await this call, since this would prevent the app from initializing correctly. Inside the Run we can do whatever we want to initialize the application. When it’s done, it simply calls Set on the ManualResetEvent.

private static readonly ManualResetEvent initWaiter = new ManualResetEvent(false);
private async void InitCodeThatTakeAWhile()
{
    // DON'T wait, or you'll block the caller
    Task.Run(async () =>
    {
        // Put init code here - can take as long as you want
        await Task.Delay(10000);
        initWaiter.Set();
    });
}

The App class also exposes a method which is used to wait for the ManualResetEvent to be set. It does this on a separate thread, thus allowing any UI code to continue to execute.

public  static async Task WaitForInitToFinish()
{
    // Switch to a different thread to wait, thereby allowing UI to process
    await Task.Run(() =>
    {
        initWaiter.WaitOne();
    });
}

Lastly, we need to invoke the wait method. This should be done on any page which is, or could be, used as a startup or launch page for the application. In fact, you could create a base class and call the WaitForInitToFinish method by overriding the OnNavigtedTo method.

protected async override void OnNavigatedTo(NavigationEventArgs e)
{
    base.OnNavigatedTo(e);

    // Change to loading states....
    LoadingText.Text = "Loading....";

    // Wait for init to complete
    await App.WaitForInitToFinish();

    // Now do page init code
    LoadingText.Text = "Loaded";
}

This strategy is useful for triggering startup logic, whilst ensuring the UI doesn’t block

Data Validation and Visual States for Windows Phone and Windows

One of the developers we’ve been working with recently suggested incorporating the INotifyDataError interface into some of the view models on a particular project. As a lot of the applications we typically  work on are more consumption style applications I haven’t seen the need to add complex data validation logic; where we do need to validate one or two values we typically just have a different visual state that represents when the user hasn’t correctly filled in the required fields.

I just had a quick hunt and found http://dotnet-redzone.blogspot.com.au/2012/12/windows-phone-8-easy-and-intuitive-way.html. This post is a great starting point for implementing visual states into a Windows Phone project. A number of controls support data validation. For example the TextBox has a ValidationStates visual state group, with states for valid and invalid data. The default template doesn’t specify what these states look like but it would be easy to modify the template to provide a visual indicator when data doesn’t validate.

Modifying the validation states for a control is fine for individual controls but if you need to modify the visual state for the rest of the page you’d need to capture the ErrorsChanged event and change the visual state of the page.

One of the biggest weaknesses of the data binding framework for both Windows and Windows Phone is that there isn’t a built in mechanism for changing visual states from within a view model. There are some solutions, such as data triggers or raising an even that is captured by the page and converted into a state change. These could be combined with the ErrorsChanged event in order to build a more versatile data validation framework.

Top Social Apps for Windows Phone from fellow MVP

image

Having recently published his Windows Phone client for Tinder, I figured it’d be worth calling out some of the awesome apps Rudy Huyn has produced. I already knew most of the popular apps but what surprised me was that none of the app he’s got listed have a rating of under 3 stars. Great work Rudy – here’s a couple of the more recognisable apps for you to download and try.

6snap6tag6sec6tindrWikipedia

Windows Phone Page Lifecycle, Tombstoning and Data Caching

The title of this post sounds a little weird but is actually quite fundamental to how you develop for Windows Phone. Most training content/courses for Windows Phone seem to focus unnecessarily on the application wide events of launching, closing, activating and deactivating. These are useful to get an understanding of what tombstoning is and why it happens. However, in most cases what’s more important is knowing and understanding the page methods which you can override to intercept the page lifecycle, namely OnNavigatedTo and OnNavigatedFrom. These methods always occur as a pair and as such make a useful point at which to save and restore page data.

Let’s assume we now know that we are going to save and restore information in the OnNavigatedFrom and OnNavigatedTo. The next question is what data are we going to load and where to load it from. So now we need to look at different scenarios:

First time arriving at a page

The only thing you should rely on absolutely is the navigation uri for the page (look at the navigationeventargs). This should tell you all the information you need in order to load the data for the page. It might include a product id, a serialized object or some other identifier of the data you want to load.

Using the information from the navigation uri you then need to load the data for the page. This might come from:

- an in-memory application wide store (eg repository model)
- loaded from cached data on disk
- retrieve data from a service

Notice that these are in order of increasing latency. To make your applications appear more responsive you need to think about how you can cache content in memory and/or disk before calling out to a service

Leaving a page

When you leave a page there are two options:

- Forward navigation to some other page and/or application – in this case you need to cache the current data for the page in the State dictionary for the page. When the user comes back to the page, you should retrieve the information from the State dictionary and use it to populate the page. The advantage of the State dictionary is that it automatically handles Tombstoning for you!

- Backward navigation – in this case it’s up to you as to whether you cache the data or not. Caching the data has the advantage that if the use goes to that page again, the data can be loaded very quickly (eg browsing to the same news article again). You can’t use the built in page State dictionary for this because each time you navigate to a page, it will get an new State dictionary, so you’ll have to come up with your own caching mechanism.

Returning to a page

This is similar to arriving at a page, with the only exception that you need to look in the State dictionary first.

The important take away from this post is that looking up data should be a progressive action: start with the page State dictionary; then to an application wide in-memory cache; next look to disk; then call to a service.

Fiddler and Proxies for Windows Phone

This article from last year is a great starting point for addressing issues either with proxies or for accessing network traffic from the Windows Phone emulator: http://blogs.msdn.com/b/wsdevsol/archive/2013/06/05/configure-the-windows-phone-8-emulator-to-work-with-fiddler.aspx

Probably the missing piece for most people is step 4:

In the command windows on the bottom left corner of Fiddler type: prefs set fiddler.network.proxy.registrationhostname HostName where HostName is the name of your desktop computer

Then you can simply navigate to :8888/FiddlerRoot.cer">http://<yourhostmachinename>:8888/FiddlerRoot.cer to install the Fiddler root certificate (useful for SSL debugging!)

Visual States in Windows Phone and Windows Applications using MvvmCross

I’m a big fan of using Visual States defined in Blend to be able to see all the different states that a page/view within your application would look like under different conditions. Most of these conditions are reflected in the state of your view model. However, there is no built in mechanism for data binding to a visual state. There are a number of different ways to tackle this problem, for example data triggers to control state changes. On technique we’ve used quite successfully is to simply bubble up appropriate state changed events from the view model, which in turn triggers a state change at the page level. In this post I’m going to walk you through how we’ve extended MvvmCross to include our own base view model and base page which allows us to trigger and track the state of the page.

We’ll start by defining an interface which will be implemented by our base view model. This includes the StateChanged event and methods for invoking a state change, ChangePageState, and querying the current state, CurrentState. You’ll notice that these methods take a type parameter, this is so that we can use an enumeration, rather than string literals to define our states.

public interface IStateAndTransitions
{
    event EventHandler<DualParameterEventArgs<string, bool>> StateChanged;
    void ChangePageState<T>(T stateName, bool useTransitions = true) where T : struct;
    T CurrentState<T>() where T : struct;
}

Next, we’ll implement the IStateAndTransitions interface in our BaseViewModel class. This class also inherits from MvxViewModel, bringing with it all the goodness of MvvmCross.

public class BaseViewModel : MvxViewModel, IStateAndTransitions
{
    public event EventHandler<DualParameterEventArgs<string, bool>> StateChanged;

    private readonly Dictionary<string, string> currentStates = new Dictionary<string, string>();
    public T CurrentState<T>() where T : struct
    {
        var current = currentStates.SafeDictionaryValue<string, string, string>(typeof(T).FullName);
        var tvalue = current.EnumParse<T>();
        return tvalue;
    }

    public void ChangePageState<T>(T stateName, bool useTransitions = true) where T : struct
    {
        var current = currentStates.SafeDictionaryValue<string, string, string>(typeof(T).FullName);
        var newState = stateName.ToString();
        if (string.IsNullOrWhiteSpace(current) || current != newState)
        {
            currentStates[typeof(T).FullName] = newState;
            StateChanged.SafeRaise(this, newState, useTransitions);
        }
    }
}

The last thing to do is to extend the MvxPhonePage to wire up an event handler for the StateChanged event. The event handler simply invokes the state change by calling GoToState on the VisualStateManager.

public class BasePhonePage : MvxPhonePage
{

    protected IStateAndTransitions StatesAndTransitionsViewModel
    {
        get
        {
            return DataContext as IStateAndTransitions;
        }
    }

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        base.OnNavigatedTo(e);

        var satvm = StatesAndTransitionsViewModel;
        if (satvm != null)
        {
            satvm.StateChanged += ViewModelStateChanged;
        }
    }

    private void ViewModelStateChanged(object sender, DualParameterEventArgs<string, bool> e)
    {
        //var controlName = e.Parameter1;
        var stateName = e.Parameter1;
        var useTransitions = e.Parameter2;

        // Locate the control to change state of (use this Page if controlNAme is null)
        Control control = this;
        VisualStateManager.GoToState(control, stateName, useTransitions);
    }

    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        var satvm = StatesAndTransitionsViewModel;
        if (satvm != null)
        {
            satvm.StateChanged -= ViewModelStateChanged;
        }

        base.OnNavigatedFrom(e);
    }
}

For completeness you’ll also need the parameter and dualparameter event args classes. These are used to make it easier to pass data values around when raising events.

public class ParameterEventArgs<T> : EventArgs
{
    public T Parameter1 { get; set; }

    public ParameterEventArgs(T parameter)
    {
        Parameter1 = parameter;
    }

  public static implicit operator ParameterEventArgs<T>(T parameter)
    {
        return new ParameterEventArgs<T>(parameter);
    }
}

public class DualParameterEventArgs<T1, T2> : ParameterEventArgs<T1>
{
    public T2 Parameter2 { get; set; }

    public DualParameterEventArgs(T1 parameter1, T2 parameter2):base(parameter1)
    {
        Parameter2 = parameter2;
    }

    public static implicit operator DualParameterEventArgs<T1, T2>(object[] parameters )
    {
        if(parameters==null || parameters.Length!=2) return null;
        return new DualParameterEventArgs<T1, T2>((T1)parameters[0], (T2)parameters[1]);
    }
}

Now, let’s see this in action in a view model, FirstViewModel:

public class FirstViewModel : BaseViewModel
{
    public enum FirstStates
    {
        Base,
        Loading,
        Loaded
    }

    public async Task LoadData()
    {
        ChangePageState(FirstStates.Loading);
        // Load some data (async to ensure no UI blocking)
        ChangePageState(FristStates.Loaded);
    }
}

Your page, FirstView, needs to inherit from BasePhonePage and have visual states called Loading and Loaded. The “Base” enumeration value is there just to represent the default state of the page. You should never have a state called “Base”, nor should you call ChangePageState with a value of Base. You can however, call CurrentState and compare the value to Base to see if a state has been set.

Hope this makes it easier for you to build your visual states in Blend.

Nokia Lumia Black Update and App Folder

From Nokia: http://conversations.nokia.com/2014/01/09/lumia-black-update/

The one thing that I thought was “cute” was the App Folder idea. If you recall clustering apps into folders/groups has been around since almost the beginning of guis (eg you could group programs in Windows 3.11). Which is why Apple was ridiculed when it claims that introducing folders was innovative.

I’m not saying App Folderis at all innovative but it can be a useful feature to the platform. Unfortunately it does require apis that aren’t available to third party developers to build this functionality which is why it had to wait for Microsoft or Nokia to build it. I do live the fact that it doesn’t require an OS refresh in order to get this app. I also like the fact that the images on the folder tile are big enough to see what’s actually in there, particularly with the wide tile. Here’s mine for games…..

image

Querying data from the Windows Phone and Windows Stores

We had a requirement today to query both the Windows Phone and Windows Stores for information about some of the apps we’ve been working on. Since both stores have a rich client interface it’s only natural that the store can be queried via a hidden pseudo api (“pseudo” because they’re more feed-like than a real api).

To work out how the api is structured the easiest thing to do is to setup Fiddler with SSL decoding and remote connections enabled on one computer and then on your Windows Phone and/or Windows 8 device you set the Fiddler computer to be the proxy. In order for this to work you’ll need to install the Fiddler certificate onto the device (Windows Phone installs the certificate correctly by default; Windows 8 you’ll need to put the certificate into the Trusted Root Certificate Authorities store for it to work).

Here’s what I pulled from my Windows Phone:

Application Info URL

http://marketplaceedgeservice.windowsphone.com/v8/catalog/apps/{app guid}?os=8.0.10211.0&cc=AU&lang=en-US

Replace “app guid” with the Guid for your application. You can find the Guid for your application by finding the application in the web version of the Windows Phone Store and then looking in the address bar.

Image URL

http://cdn.marketplaceimages.windowsphone.com/v8/images/{image guid}?hw=486577666&imagetype=icon_small

Replace “image guid” with the Guid for the image you want to retrieve. The image Guids are listed in the information returned from the application info URL.

 

Here’s what I pulled from my Windows 8 device:

Application Info URL

https://next-services.apps.microsoft.com/browse/6.3.9600-0/776/en-GB_en-AU.en-US.en/c/AU/cp/10005001/Apps/{app guid}

Replace “app guid” with the Guid for your application. You can find the Guid for your application by finding the application in the web version of the Windows Store and then looking in the address bar.

Image URL

http://wscont1.apps.microsoft.com/winstore/1.4x/{image path}

Replace “image path” with the relative path to the image that you want which can be found in the Application Info URL

Boosting Reviews of your Windows Phone Application using the MarketplaceReviewTask Launcher

One thing that so many developers forget is that reviews are a crucial element in driving the adoption of your application. Not only do a lot of developers forget to provide a link to submit a review within their application, they also don’t prompt the user to post a review. Here’s a simple suggestion that should help drive reviews:

- Make sure the user can navigate to the Windows Phone Store review page for your application from somewhere within your application

- Prompt the user to complete a review based on some algorithm eg:

         > After X days of using the app

         > After running the app X number of times

         > After successfully completing something within the app

The simplest way to navigate users to the review page is using the MarketplaceReviewTask:

MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();
marketplaceReviewTask.Show();

Windows Store In App Purchase ArgumentException when calling LoadListingInformationAsync

When you couple poor API documentation with dumb developer decisions you can cause developers to waste hours trying to diagnose issues with their apps. We’ve just tracked down an issue with calling CurrentApp.LoadListingInformationAsync from a Windows Store application we’re building. Whilst calling the same method on the CurrentSimulatorApp works without throwing exception, calling the method on CurrentApp throws an ArgumentException with message "Value does not fall within the expected range."

Initially we thought that this issue was related to the app not being published in the Store, so we submitted and published the app. Unfortunately the exception continues….

This thread: http://social.msdn.microsoft.com/Forums/windowsapps/en-US/0de52a76-2ec3-4b82-8d38-7385f22132f0/currentapploadlistinginformationasync-throws-argumentexception

holds the answer – you need to call this method from the UI thread.

Points to remember when building an API:

- You shouldn’t design an API that needs to run on the UI thread, that isn’t UI related

- You should document possible exceptions

- If you’re going to provide a simulator API

    - The simulator should implement an interface so it can be mocked properly

    - The simulator should mirror the behaviour of the real thing (in throw similar exceptions!)

Windows Phone Dev Fusion

Some of the Windows Phone MVPs are putting together some awesome online content later this month

“Along with Christmas we have a little gift from the Windows Phone development community for you: The WPDev Fusion „New Year Edition“, supported by Microsoft and Nokia. This is an evolution of the Windows Phone Week from last october, where over 1500 developers participated in. But these events also have a few downsides: You have to be at a specific time at a specific place in conjunction with travel costs. Here actually WPDev Fusion comes into the game as this event is pure virtual. Relaxed from your couch you can join this global event on January 22nd.”

More info at http://winphonedev.de/2013/12/23/ankndigung-zu-wpdev-fusion-new-year-edition-announcing-wpdev-fusion-new-year-edition/