Windows Phone 7 & Windows 8 Metro Apps

Given the differences between the Silverlight on Windows Phone 7 and XAML for WinRT on Windows 8, I thought it will be interesting to see what the differences are between these two platforms.

A few days back I wrote a quick and dirty application for checking weather forecasts for a given location in Windows Phone 7. It is a very simple application, however I was curious if I can use the same code base for WinRT metro apps on Windows 8.

Namespace and Base Page

The Windows Phone 7 controls reside in the namespace ‘Microsoft.Phone.Controls’ and the controls for Windows 8 XAML metro apps reside in ‘Windows.UI.Xaml.Controls’.

The pages for Windows Phone 7 pages derive from PhoneApplicationPage, whereas the metro apps derive from Windows.UI.Xaml.Controls.Page.

XAML

The user interface controls for both Windows Phone 7 and Windows 8 metro apps are implemented in different namespaces, however they are very similar and are mostly reusable.

The same XAML may conform for both platforms, however Windows 8 are slated to be used on screens that are bigger like a tablet or a PC (and sometimes much bigger like a TV screen). So the applications may be better off if the user interface design for metro apps can utilize that larger real estate.

My sample application for Windows Phone 7 was using the ‘WebBrowser’ control, but I couldn’t find this control in the metro apps. However, a very similar control called ‘WebView’ is present in Windows.UI.Xaml.Controls namespace.

There are some minor differences in the implementation, but I was able to replace the WebBrowser control with the WebView control without much effort.

win8_vs2011_weatherwatch_designer

Windows 8 Target Screen Sizes

win8_vs2011_toolbox_platform_screesizes

Visual Studio 11 for Windows 8 also allows  designing applications for different target sizes, as the target can differ from a wide variety of screen sizes.

1366×768 is the minimum resolution required for all metro apps. The designer having this ability to set various screen sizes is a great boon for the developers in knowing before hand how the XAML markup will render in the supported screen sizes.

 

The designer also supports setting the user interface as portrait mode.win8_vs2011_weatherwatch_designer_portrait

WebClient API is not supported

The sample application in Windows Phone 7 used WebClient to pull weather data from yahoo, but WebClient is not supported in WinRT. However, HTTPWebRequest class is supported in WinRT. In fact, this is the only web request API supported in WinRT. HTTPWebRequest is also available in Windows Phone 7. See my previous post about WebClient vs HTTPWebRequest in Windows Phone 7 here.

The final application on WinRT

win8_weather_watch

With the very limited functionality I was testing, most of the porting was smooth, except for the surprise that WebClient was not supported.

As for user interface, even though most of the XAML could be reused, I think it is to the benefit of the application that it be designed specifically for the screen sizes they are targeted for.

So, can applications have a common code base for both the platforms? If the applications are layered properly using the MVVM (Model-View-View Model) pattern, the ‘model’ and ‘view model’ can have a common code base, whereas the ‘view’ can benefit from being separate at least for some of the applications.

Experiments with Windows 8 Consumer Preview

win8_start_screen_1I finally got a chance to install Windows 8 and take it for a test ride. Having installed the Windows 8 Developer Preview which came out last year, the Windows 8 Consumer Preview is much more stable with very few visible bugs.

I followed the excellent instructions provided by lifehacker to boot Windows 8 side by side with Windows 7, which is already running on my laptop. If you are not familiar with partitioning your hard disks, be very careful while trying to dual boot as choosing the incorrect partition can erase your existing installation.

On the Start screen, all the applications are shown in what are called ‘Tiles’. If you are familiar with the Windows Phone interface, it looks much similar.

Desktop is provided as an ‘app’, which takes the user to the much familiar PC interface that most PC users are familiar with. Desktop looks much similar to a Windows 7 screen, but ouch, where is the start button? Pressing the Windows Key on the keyboard takes the user back to the start screen with ‘Tiles’.

At present there are not many apps to boast about in the marketplace, but I expect this situation to change as more and more developers start publishing their apps to the marketplace.

Some applications that have already got some traction in other platforms like ‘Kindle’ and ‘Cut The Rope’ are already in the marketplace.

win8_store_kindle_1win8_cut_the_rope_game1

 

Corner Quick Menus

From a touch interface, one can slide from side, the top, bottom etc. but doing that with the mouse is not going to be very easy. As per Microsoft, one can move the mouse effortlessly to each corner of the screen and this is where some of the Windows 8 menus pop out from.

Move the mouse to the bottom left corner, the start menu pops out. Click on the start menu brings the user right back to the start screen. Pressing the windows key on the keyboard also has the same effect.

win8_start_screen_popup_1

Moving the mouse to the top left corner brings out the application bar with a preview of all the running applications. This is a very quick way to switch between currently running applications. Equivalent keyboard shortcut is Windows Key + Tab.

win8_currently_running_applications_bar_1

 

Windows Charms

Windows 8 has implemented something called ‘Windows Charms’, which is a quick menu that is available for all the applications. Move the mouse to the top right corner to access the Charm.

win8_start_screen_charm_bar_1

In the charm bar, there are buttons like Share and Search, which each application can utilize accordingly.

Keyboard friendly as it is touch friendly

It is primarily touted for touch interface devices, however almost all the ‘goodness’ of Windows 7 keyboard friendliness have been retained.

Windows 7 users will find many of their favorite shortcut keys working on Windows 8 including the Alt+Tab combination for switching between the applications.

win8_alt_tab_window_switching_1

 

Task Manager

Task Manager is greatly enhanced and now has a sporty user interface.

win8_taskbar_performance_1

A great additional feature that has been added is that now it can track CPU, memory and bandwidth usage of applications over a period of time. On mobile devices where internet usage is metered, this can come in handy to find out what applications are eating up the most bandwidth.

win8_taskbar_app_history_1

 

Compatibility with existing hardware

The web installer runs a compatibility checker before installing Windows 8 to verify if the existing hardware and software is compatible. Interestingly enough, the only incompatible application that was found on my computer was the ‘Security Essentials’ anti-virus software from none other than Microsoft itself.

NVIDIA Drivers

I noticed one problem after installing the Windows 8, it was not detecting the NVIDIA graphics card. My laptop has a NVIDIA GeForce 210M. NVIDIA has released the drivers for Windows 8 32-bit and 64-bit, however some laptops like SONY VAIO require to get these drivers directly from SONY instead of NVIDIA. Installing the drivers from NVIDIA was stopping at a point where it suggests to contact the laptop manufacturer to provide the drivers. However, SONY has not released the NVIDIA drivers for their hardware yet. argh!

Considering that most of the underlying stuff in Windows 8 is carried forward from Windows 7, I wanted to try installing the NVIDIA Windows 7 drivers on Windows 8. How bad can it get? The worse case scenario would be for me to re-install Windows 8.

I took the gamble and installed the Windows 7 64-bit NVIDIA drivers provided by SONY and voila! it worked like a charm!

(Install at your own risk)

win8_device_manager_nvidia_geforce_210m

 

All in all, it is a bold new endeavor and is certainly fun to use. Even though it looks very promising, it remains to be seen how well the marketplace develops which is a crucial factor in the success of Windows 8 on touch interface devices.