Sharing Code between Windows, WinRT and Windows Phone

Monday, December 16, 2013

In recent times, I often find myself developing for more than one “Windows” platform – typically Windows Phone and Windows 8 Store and sometimes Windows (WPF) as well. In this post, I’d like to share some of the tools and techniques I’ve been using to ease code sharing. Portable Class Libraries (PCLs) PCLs came out in Visual Studio 2012 and provide an easy way to create a single project that can be referenced by multiple project types. When you create a PCL, you get the following dialog: This dialog allows you to select multiple targeted platforms (at...

MVVM View vs. Control

Sunday, November 3, 2013

In the MVVM world, Views are attached to ViewModels. How can a view be implemented? Typical answers for say, WPF, are: Window, User Control and Data Template. Similar answers exist for Windows Phone and Windows 8, where “Window” may be dropped or replaced by Page.This is certainly true, but about that User Control? Can any user control automatically be considered a View? Not quite.The distinction between view and control (user control or otherwise) is based on reusability and dependency. A View requires a ViewModel to give it context. A View cannot function without a ViewModel. Typical XAML View would...
no comments

Build 2013 Summary

Saturday, June 29, 2013

The Microsoft Build 2013 conference is now over, so it’s time for some summaries and impressions. All the following is my personal thoughts from my viewpoint, and may not reflect the way things actually are. Last caveat – some of the information is based on the sessions I attended. Naturally, I couldn’t attend most sessions, and I may not even remember all info given in the session I attended. Still…The conference was 3 days in length. With about 14 sessions going on at the same time slot, this is too short a conference; 4 days would have been better....

Webcasts on Windows Phone 8 development

Wednesday, March 27, 2013

Recently, I’ve done two sessions on Windows Phone 8 development, that are available on YouTube. If you’re new to Windows Phone, these sessions may help you to get started. The session are in English and are comprised mostly of coding examples. A third session is planned to happen about 2 weeks from now.First session: Second session:Enjoy!
no comments

Windows Phone Tip: Beware of PhoneApplicationService.State

Monday, March 18, 2013

A Windows Phone 8 app may be in one of several states:In the running state, it’s the foreground app and the user is working with the app. So far good.If the user taps the Start hardware button, he’s taken to the Home screen (naturally), and our app becomes dormant. In this state, all its memory is intact, but all threads are suspended so that app cannot consume any CPU time. Entering this state causes the PhoneApplicationService.Deactivated event to be fired. The app should save its state because the app may later become tombstoned.Tombstonening means the app loses all its...
no comments

XAML Tip: Graphics with ItemsControl

Saturday, February 23, 2013

Sometimes in a WPF or Windows Store or Windows Phone application we need to draw some things based on some collection of data items. Suppose we have the following simple data item: class CarData { public double Distance { get; set; } public string Image { get; set; }}Suppose we have a collection of CarData objects, and the requirement was to show a set of images along a line with a particular distance, like in the following screenshot:The distance from the left is determined by the Distance property, and the image is determined by...

Windows 8 & Phone 8: Next User Group Meeting

Sunday, October 14, 2012

The upcoming user group meeting is a special one: the post BUILD conference meeting. It’s going to take place on November 6th, just a few days after BUILD is over. Elad Shaham and myself will be joined by Tzvia Gitlin from Microsoft, to discuss Windows 8 and Windows Phone 8 (due to be released on October 29th, just one day before BUILD starts), including impressions from the BUILD conference (where I will attend personally). We’ll talk about new Windows Phone 8 features, the SDK, emulator among other things, some of which will be first unveiled at the BUILD conference.Since...

Windows Phone 8 is soon upon us (and MS Israel hands out 7.5 phones)

Sunday, September 9, 2012

(this is not my typical technical post, but it’s nice to have something different for a change)A few days ago Microsoft and Nokia held a press conference in New York, in which Nokia presented two new phone devices running Windows Phone 8: The Lumia 820 and the Lumia 920. This announcement made a short while after Samsung announced its first WP8 device, the ATIV S.You can watch the press conference video here. The 920 sure looks impressive in style and functionality.Windows Phone 8 is expected to be publicly available on October 29th (according to rumors…), a few days after...
no comments

Windows Phone: Playing Sound Effects

Monday, September 3, 2012

I wanted to create a simple timer application for Windows Phone. The timer would count backwards from a user configured value and when it reached zero, it would play some sound effect to indicate expiration. Sounds simple enough…This is how the application looks like:The problem turned out to be playing that sound effect. I had a WAV file I wanted to play. Silverlight has a MediaElement object that is capable of playing video and/or audio, so it seemed to be a good candidate for the job. MediaElement is an element, so must be placed somewhere in the visual tree....
no comments

Windows 8 & Phone 8 UG August Meeting

Wednesday, August 29, 2012

Last evening we had a User Group meeting in Microsoft Offices in Ra’anana, with a lot of activity and fun. Thank you all for participating!In the first part, we discussed the Windows 8 Store from various angles, end user and developer.In the second part, we discussed Windows Phone 7.x and the upcoming 8, along with other sporadic topics - C++, WinRT, DirectX, COM, XNA, XAML… it was fun! And don’t forget the giveaways!Just as a gentle reminder, out next meeting is on September 13th, where we’ll have an interesting session on “Metro” User Experience and User Interface from an...