BT

Windows Share, a New Data Exchange Mechanism in Windows 8

| by Abel Avram Follow 9 Followers on Sep 23, 2011. Estimated reading time: 3 minutes |

Microsoft has created a new mechanism for sharing information between applications in Windows 8 called Windows Share. Apps can share text, bitmaps, HTML, URI, files, and other type of data, and the usage scenarios are numerous. For example, the app receiving the information can post it to Tweeter or Facebook make it easy to post information to a social network without actually visiting it.

Billie Sue Chafins, Senior Program Manager Lead, and Steve Seixeiro, Partner Development Manager, Microsoft Corporation, presented the session “Share: your app powers the Windows 8 share experience” at BUILD 2011. They detailed the new sharing feature coming up in Windows 8. Windows Share is sort of a universal live clipboard, allowing applications to transfer information between them, but it is much well integrated into the system and richer compared to the traditional clipboard.

Windows Share accepts the following standard data formats: text, RTF, bitmaps, storage items (e.g. files), URI, HTML, but there is also the extensible format that can be used to transfer any stream of information: addresses, contacts, people, geo-location, etc. When the user wants to share some information from an application, he is presented with a list of applications accepting the respective type of information, and the data is transparently transferred upon selecting one of them.

The Share features defines the following types of participants to the process:

  • Source – any application that has information for sharing with other applications
  • Target – any application consuming the information shared by other apps
  • Broker – the transfer mediator between the source and the target

Most applications can be a source, if it has anything to share, and Microsoft encourages developers to make their applications sources of information. Targets will be those applications interested in receiving and processing information. The advantage of Share is the fact that Windows will have built-in protocol for exchanging information and applications developers no longer need to agree on a certain format in order to be able to exchange data. For extensible formats, the parties involved need to agree on the data format used, so it is recommended to use standardized ones such those supported by Schema.org.

One example is sharing a web page’s URL or some text from IE to social networks such as Twitter or Facebook, the target applications Tweet@rama and Socialite taking care of posting data to the respective networks. The information sharing possibilities are numerous, and it is expected the developers to create many such applications.

To share data the source needs to register with the Data Transfer Manager, and it is informed when the user selects the Share command on Windows, then prepares the Data Package and sends it to the Broker via an asynchronous call. The Broker determines which targets have registered for accepting the corresponding type of data transferred by the source and lists them so the user can select one. When the user has chosen a target the broker activates that application and gives it the data package. The whole process is finished by the target informing that the transfer was complete as depicted in the graphic below:

image

At low level, Share is done the new Windows.ApplicationModel.DataTransfer assembly belonging to Windows Runtime (WinRT). This is what it looks like to prepare a source for sharing in JS:

// set up data transfer manager

var dataTransferManager = Windows.ApplicationModel.DataTransfer.DataTransferManager.getForCurrentView();

// create event listener to be called on to fill out data package

dataTransferManager.addEventListener("datarequested", function (e) {

// fill in data package with what to share

var request = e.request;

request.data.properties.title = "Title for data";

request.data.properties.description = "Description of the data";

request.data.setText("Text to share");

...

});

The target needs a bit more work including the modification of the application’s manifest file and the creation of an HTML page which is displayed by Windows when the user selects the respective application for sharing. Visual Studio provides basic templates to set up an application for sharing, so the work is half way done.

Windows Share looks like an easy way to exchange information between applications in Windows 8 and fits well with the new Metro interface.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Javascript not C# by Bruce Williams

That code is Javascript, not C#. You don't define inline functions like that in C#.

Re: Javascript not C# by Bill Sobel

"That code is Javascript, not C#. You don't define inline functions like that in C#."

Someone doesn't know C# very well...

Re: Javascript not C# by chris martin

"Someone doesn't know C# very well..."

The joke's on you, buddy. That is 100% Javascript. There is no "function" keyword anywhere in C#.

Share-feature is not really new.. by Florian Murk

..if you take a look a the freeware tool Clickto.
That tool connects your applications via copy-paste to local software and online services.
Click.to Website

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

4 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT