Windows 8 Conference Buddy–Be A Sharing Target

Yesterday, we looked at being a sharing source.  This was surprisingly easy.  Being a target would be more complex except that Visual Studio provides a template that greatly simplifies the process.

By using the template, we avoid having to set the package appxmanifest and we avoid having to muck about in App.xaml.cs.  All that work is done for us.  To see this at work, create a new application and name it SharingTarget.

Right click on the project in Solution Explorer, and choose Add –> New Item.  From the list, select Share Target Contract and use the default name.

You will be prompted that there are required files that Visual Studio can add for you.  Click Yes.

ShareTargetIncludeFiles

Wait a few seconds and you’ll see that a number of files have been added to the Common Directory and that ShareTargetPage1.xaml has been added to your solution.

That’s it! You now have a target.  The sample page provides all the needed information, including the ability to add a comment.

To see this at work, run the program once (to register it) and then stop the new target program. Remember that targets don’t have to be running to be in the target list; if the user selects your target application it will be started for you.

Return to the source application that we built yesterday and start that up.  Swipe to bring in the charms and touch the sharing charm. Notice the list of target applications now includes your new application.

ShareTargetRunning

 

If you click on SharingTarget (the application you just created) the text version of the data is picked up as our target currently only supports text (if you try Mail you’ll still see the HTML version).

Note that this new application doesn’t do anything with the data you’ve shared; you’ll have to write additional code to integrate that data into your new application.

Share

About Jesse Liberty

Jesse Liberty is a Master Consultant for Falafel Software, and has three decades of experience writing and delivering software projects. He is the author of 2 dozen books and multiple Pluralsight courses, and has been a Technical Evangelist for Telerik and for Microsoft, a Distinguished Software Engineer for AT&T, a VP for Information Services for Citibank and a Software Architect for PBS.
This entry was posted in Contracts, Mini-Tutorial, Windows 8 and tagged . Bookmark the permalink.

5 Responses to Windows 8 Conference Buddy–Be A Sharing Target

  1. I like the helpful info you supply for your articles. I will bookmark your weblog and test again right here regularly. I am rather certain I’ll be told lots of new stuff right right here! Best of luck for the next!

  2. Vps Servers says:

    Woah this weblog is fantastic i really like studying your articles. Stay up the good paintings! You know, a lot of people are hunting round for this information, you can help them greatly.

  3. testdomain says:

    Well I truly liked studying it. This article provided by you is very useful for good planning.

  4. vps says:

    I think your blog is amazing. You write about very interesting things. Thanks for all the tips and information.

  5. Pingback: Windows Store Developer Links – 2013-02-22 | Dan Rigby

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>