Sonntag, 28. November 2010

Windows Phone 7: Customize live tiles, push notification

Found a good article of Chris Koenig about customizing the tiles with Windows Phone 7 Push Notification Services:

Customizing WP7 Push Notification Tiles « Development « Chris Koenig

Montag, 22. November 2010

Windows Phone 7: Recording the microphone

Description and sample project for recording something with the Windows Phone 7 microphone.

Writing a Proper Wave File - CodeProject

Windows Phone 7: Video Player with MVVM pattern

If you plan to implement a video player for Windows Phone 7 you could found a good solution using the MVVM pattern here: Windows Phone 7 View Model Style Video Player - CodeProject

Freitag, 19. November 2010

Windows Phone 7: No forward navigation

Information forward navigation at Windows Phone 7:

Navigation Stack on Windows Phone 7 - Peter Foot - APPA Mundi

“While Windows Phone uses the same NavigationService and page-based model as “regular” Silverlight, one area the documentation doesn’t make clear is that although the APIs seem to support both Back and Forward navigation in reality there is no forward navigation on Windows Phone. This means when you navigate to a new page and then return Back to the previous page you can’t call NavigationService.GoForward() to return. CanGoForward will always return False. In the documentation for System.Windows.Controls.Frame (the base class of PhoneApplicationFrame) GoForward is described as:-

“Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation. For Windows Phone this method will always throw an exception because there is no forward navigation stack.”

(my use of bold)”

Mittwoch, 17. November 2010

Windows Phone 7: Handle Back button for a open popup

If you are pressing the back button in your Windows Phone 7 app with an opened popup, the NavigationService will leave the current page and navigate back to the previous page on the navigation stack.

To close the popup instead of navigating, you can use this: Handling the “Back” Button with a Popup Open on Windows Phone 7 | Toetapz's Blog

Sonntag, 14. November 2010

Windows Phone 7: Using threading for heavy operations

For developers of Windows Phone 7 apps it is important to know all existing concepts of scheduling tasks on Windows Phone 7. At Windows Phone 7 the core threads are the Compositor Thread which interacts with the GPU and the UI Thread. The UI Thread is the main thread, where all your code will normally be executed. But the UI Thread have to handle some important events of the OS and is responsible for the layout management. Therefore it is not a good idea to do heavy actions in the UI thread, because then your app will loose very quickly the “smooth” experience of Windows Phone 7.

The normal way is to create for this heavy operations (parsing JSON, rendering bitmaps, etc.) a new thread directly or using the  BackgroundWorker class. An alternative way you can found at

Scheduling tasks on Windows Phone 7 | .NET Zone.

Instead of using the direct ways for new thread creation, you could use the built-in scheduling mechanism which are in the namespace Microsoft.Phone.Reactive. The Scheduler class in this namespace allows you to defer execution of pretty much everything you need. You can either directly operate with Scheduler or via IScheduler, that will get a thread instance from Scheduler.

Samstag, 13. November 2010

Using authenticated RIA Services with Windows Phone 7

In my older post RIA Services: Windows Phone 7 and SOAP endpoint | .NET - Red zone : Best practices and latest stuff I have described how a RIA Service can be used as normal WCF SOAP service for example with Windows Phone 7.

But if you want to use RIA Services with Windows Phone 7, there is the problem that Silverlight for Windows Phone 7 does not support authentication headers. But using the instructions here Using Authenticated Ria Services on your WP7 phone - Marcel de Vries, MVP Team System - blog community you can still use the cool authorization mechanism of WCF RIA Services with Windows Phone 7.

The key steps are:

1. Add enableHttpCookieContainer="true" to your ServiceReferences.ClientConfig

After the proxy is generated enable the HttpCookieContainer at your bindings for authentication service and your domain service. You have to remove it for each proxy new configuration to avoid an error message during proxy generation.

   1: <bindings>
   2:             <basicHttpBinding>
   3:                 <binding name="BasicHttpBinding_AuthenticationServiceSoap" maxBufferSize="2147483647"
   4:                          enableHttpCookieContainer="true"
   5:                     maxReceivedMessageSize="2147483647">
   6:                     <security mode="None" />
   7:                 </binding>
   8:                 <binding name="BasicHttpBinding_EmployeeDomainServiceSoap" maxBufferSize="2147483647"
   9:                       enableHttpCookieContainer="true"
  10:                     maxReceivedMessageSize="2147483647">
  11:                     <security mode="None" />
  12:                 </binding>
  13:             </basicHttpBinding>
  14:         </bindings>
2. Store the returned cookie container of your Login-Call for the next service calls
   1: protected virtual void OnLoginCompleted(object sender, LoginCompletedEventArgs e)
   2:        {
   3:            var args = new LoginServiceCompletedEventArgs();
   4:            
   5:            CookieContainer = null;
   6:            
   7:            if (e.Result != null)
   8:            {
   9:                args.User = null;
  10:                args.Error = true;
  11:  
  12:                CookieContainer = _authclient.CookieContainer;
  13:                ViewModelLocator.AuthCookieContainer = _authclient.CookieContainer;

Hint: Don’t be surprised that the cookie container looks empty at this point (count is 0). There is a kind of “magic” cookie still in there.

3. Use the returned cookie container for your proteced domain service calls
   1: var client = new EmployeeDomainServiceSoapClient
   2:                  {
   3:                      CookieContainer = ViewModelLocator.AuthCookieContainer
   4:                  };

Donnerstag, 11. November 2010

Windows Phone 7: My Interview on Mobile360 and .NET Magazin

My interview (in german only) about developing Windows Phone 7 apps could be read at the Mobile360 – Website: Was Entwickler bei Windows Phone 7 beachten sollten or at .NET Magazin Was Entwickler ・er Windows Phone 7 wissen sollten.

Samstag, 6. November 2010

New Silverlight Toolkit for Windows Phone 7 available

The new November 2010 edition of the open source-based Silverlight Toolkit for Windows Mobile developers brings new pre-built controls that they can make your apps easily and refine. The new and exciting elements AutoCompleteBox, ListPicker LongListSelector (this control helps a lot), different page transition effects (page transitions) are now available in the current version. Of course the controls known from the previous version remain included in the scope of the Toolkit (GestureService GestureListener, ContextMenu, DatePicker, TimePicker, ToggleSwitch, WrapPanel).

You can download the toolkit here: Silverlight - Release: Silverlight for Windows Phone Toolkit - Nov 2010