Supporting light and dark theme with dynamic background images
I’m still a bit surprised in finding applications on Windows Phone 7 that doesn’t take into consideration that the user might have either the dark or light theme enabled based on personal preferences. If your app is only supposed to work in one theme, then using Jeff Wilcox tool Phone Theme Manager helps a lot (it’s also available on NuGet, simply install with “install-package PhoneThemeManager”). But what if your app also want to leverage a background image that might be downloaded from the internet or specified by the user. Since images might be very light or dark this might impact the user experience with the foreground color blending into the image, but there are a couple of solutions to that as well. Here is one very simple one:
Automatic versioning in Windows Phone
This will be a fairly short but hopefully informative post. In all of my Windows Phone projects, I always try to get the client/users as included in the testing as possible. When doing that it’s also very useful to know that they are using the latest bits of the project or at least understand which version they were using when they report bugs and change requests. I found a couple of resources online that I use to have an automatic versioning of my Windows Phone projects and here it goes:
How to get started with game programming on Windows 8
I’ve been a passionate game developer for way too many years now and when XNA was introduced (and Managed DirectX before that) I was mighty impressed with the abstractions created and how easy it was to create both simple and advanced games with managed code for Xbox 360, Windows and later the Windows Phone platform. I was equally depressed when it was announced (or actually wasn’t announced) that XNA so far hasn’t been considered a solution for building games on Windows 8. But I can understand some of the reasoning behind the strategy, and I totally appreciate the efforts being made in creating the latest release of DirectX with it’s support for Hull Shader, Compute Shader, Tesselation and all other goodies that we can leverage. And I’ve always considered game development to be the primary reason for me to keep my skills in C++ up to date so going native when building games for Windows 8 is for me an accepted challenge instead of a show stopper! But I also understand that not all have the same background in C++ and native development and hence this post on how to get started quite rapidly to build 2D games for Windows 8 with something that might look quite familiar if you have an XNA background.
Bing Maps with custom pushpin and popup interaction
When creating a solution which requires a map it’s pretty common to also display pushpins that inform the user of locations. This is very easy to accomplish in Windows Phone, but when you also want to respond to the user tapping one of these pushpins and display maybe a popup, then it becomes a bit more difficult. Here is an approach that I find both easy to implement and understand.
How to bypass the local http caching mechanism
When developing Windows Phone solutions, I’ve become quite fond of using the HttpWebRequest class to fetch information from the web, either if it’s in XML or in JSON. I’ve also had the requirement to pull data down very often (as often as every 15 seconds) from the same URL and then stumbled into some issues. It seems like the Windows Phone platform is examining the URL you request and if you try to fetch data from the same URL as previous it will simply reply with a locally cached respones with the same data as earlier. This is probably not what you want and the solution is the following:
Localization in Windows 8 compared to Windows Phone
When porting applications from Windows Phone to Windows 8, you will benefit greatly from having developed your applications in C# and XAML since most of the architecture and technologies are more or less the same. Naturally there are some differences but my experiences in porting applications tells me that most of the investments is in the design surface and overall experience of the application, not in the code.
Communication from ViewModel to View
When leveraging the MVVM pattern there’s always the discussion regarding whether or not the ViewModel should be aware of the presence of the view, and in that case how much. This comes quite apparent when trying to make the UI/view respond to state-changes in the ViewModel and especially if it’s not possible to leverage data binding to do so. Most Windows Phone developers already know that the ApplicationBar is one of the elements that doesn’t support data binding directly in the platform. There’s a couple of additional framework and/or technologies that you can leverage to actually get this support but I have myself found it to be much easier to just write some code.
Theme Enabled XNA application in Windows Phone
In an effort in creating personal applications which leverages the users preferences when it comes to light/dark theme and their specific accent color I’ve just modified the Game State Management sample. In the sample I’m using the accent color as the background for the menus and also keeping the theme background color in between game-state changes (such as in the “loading…” state). I’m not saying that it’s a perfect solution but still something that I find easily could be adapted to fit more custom solutions.
Beware of DispatcherTimer, use with care!
There’s two timer-objects available (at least) in Windows Phone 7. The Timer and the DispatcherTimer. The major difference is naturally that the DispatcherTimer handles dispatching to the UI thread which makes it very appealing for background tasks which will periodically update the UI. But there is also a very interesting behavior that I’m not certain everyone is aware of.
Application Bar icons with transparency, still Metro enough?
I recently had an evening with some graphic inspiration during which I tried to leverage transparency to give the icons in the application bar in Windows Phone 7 a bit more depth or maybe simply another look. Some of them came out quite nice I think but I’m curious if they still are metro enough to actually pass certification as well as the appreciation of the actual users.