Background Tasks, Exposing existing .NET Tasks in WinRT and Patterns of Parallel Programming in .NET

 

These are very good resources describing WinRT background tasks, Parallel library in .NET .

Background Tasks in Windows RT

This paper describes the programming model to create background tasks, resource management policies for background tasks, and built-in user controls that allow the user to control per-app background task activity by using lock screen personalization.

Exposing existing .NET Tasks as WinRT async operations

In Win RT every operation which takes more than 50ns have to be executed as async tasks.

Important thing to note are :

Fields, parameters, and return values of all the public types and members in your component must be Windows Runtime types. In the .NET Framework, primitive types like the Int32 structure have many useful properties and methods, such as the TryParse method. By contrast, primitive types and structures in the Windows Runtime only have fields.

Example list :

The following table lists the most common of these generic interface types, along with other common class and interface mappings. For a complete list of Windows Runtime types that the .NET Framework maps, see .NET Framework mappings of Windows Runtime types.

Windows Runtime .NET Framework
IIterable<T> IEnumerable<T>
IVector<T> IList<T>
IVectorView<T> IReadOnlyList<T>
IMap<K, V> IDictionary<TKey, TValue>
IMapView<K, V> IReadOnlyDictionary<TKey, TValue>
IKeyValuePair<K, V> KeyValuePair<TKey, TValue>
IBindableIterable IEnumerable
IBindableVector IList
Windows.UI.Xaml.Data.INotifyPropertyChanged System.ComponentModel.INotifyPropertyChanged
Windows.UI.Xaml.Data.PropertyChangedEventHandler System.ComponentModel.PropertyChangedEventHandler
Windows.UI.Xaml.Data.PropertyChangedEventArgs System.ComponentModel.PropertyChangedEventArgs

For a complete list of mapping .NET Types to WinRT types check here.

Read this detailed post explaining the steps to expose existing .NET tasks as WIN RT async operations.

Patterns of Parallel Programming in .NET

This paper provides a detailed and in-depth tour of support in the Microsoft® .NET Framework 4 for parallel programming. This includes an examination of common parallel patterns and how they’re implemented without and with this new support in the .NET Framework, as well as covering best practices for developing parallel components utilizing parallel patterns.

 

Advertisements