Portable Class Libraries for reuse between Window Store app and Windows Phone app

Feb 8, 2013 at 6:05 PM
This looks like an interesting application from which to learn best practices.

I'm currently working on a WPF desktop application which is going to share some code with a Windows Store app and probably a Windows Phone app. I'm trying to put most of my client side code in Portable Class Libraries - at least the ViewModels should be reusable between the three platforms.

Do you have a suggestion of what it would take to convert the UILogic project to a PCL that is reusable for at least WP8? I think one of the arguments to go the XAML/C# way today is the possibility to fairly easily write apps that target tablets, smart phones and desktops with a high degree of shared code among the three platforms.
Feb 13, 2013 at 6:14 PM
the UILogic project is application specific to AWShopper. I think the one you would want to be a PCL in concept is the Kona.Infrastructure library that contains reusable code. However, the difficulty is that the platforms are different enough that some of the features we were trying to encapsulate (navigation, state management, working with charms) are specific to the platform, and we were trying to make the code so that developers can be as productive as possible on WinRT. Any time you try to make code work on multiple platforms, you necessarily have to dumb it down to the least common denominator. Cross platform was not in our charter or goals in building Kona, so it did not make sense to do less just to keep it in a PCL. Where we could, we took that approach - we ported the EventAggregator from Prism to a PCL so it can be used cross platform. But things like the ViewModel, Page, and App base classes could not be done that way because they are encapsulating platform specific features.