Windows 8 Hands-on Experiment Tutorial Experiment 3: Searching and sharing

Source: Internet
Author: User
Tags visual studio

Experiment 3: Search and share

September 2012

Brief introduction

One of the key features of the Windows 8 user experience is the use of super buttons. It responds to the light sweep or Windows logo +c key and slides out from the right side of the screen. These buttons (the "Super button") provide a means for Windows store applications to expose common functions between applications in a consistent way. For example, if you need to execute a search in your application, you can choose to search for the Super button and enter a search entry in the Search pane. The user interface and the actions that invoke the above interface are the same in every application. To share data with another application, you use the shared Super button. An application that supports sharing can share data. For example, a drawing application can share a picture with other applications that support sharing, or Contoso cookbook can share recipes with other applications that support sharing,

In this experiment, you will add search and sharing support for Contoso cookbook. You will get a first-hand experience of implementing search and sharing contracts. You will also learn how these contracts provide a higher level of integration between two applications or between applications and Windows itself.

Goal

This experiment will show you how to:

Implementing sharing in Windows Store applications

Implementing a search in a Windows application store application

Implementing Search Suggestions

System Requirements

You need the following software to complete this experiment:

Microsoft Windows 8

Microsoft Visual Studio 2012

Set up

You must perform the following steps to prepare the computer for this lab:

1. Install Microsoft Windows 8.

2. Install Microsoft Visual Studio 2012.

Practice

This hands-on experiment includes the following exercises:

1. Add Recipe Share

2. Add Recipes Search

Estimated time of completion of this experiment: 30-40 minutes.

Exercise 1: Add a recipe share

In Exercise 1 you will add shared support to Contoso cookbook so that recipes can be shared by other applications. You will share two types of data for each recipe: The name of the recipe, the raw material, and the text data for the guide and the image data that represents the recipe graphic.

Task to call the shared Super button

First, let's look at how the shared Super button behaves when it is invoked in Contoso Cookbook before the shared support is added.

1, open the Contosocookbook project that you completed in Experiment 2 in Visual Studio. If you have not completed experiment 2 or want to start with a reference copy, you can find the completed version of the experiment in the start material.

2, press F5 to start Contoso Cookbook.

3, click on a recipe to display items-Detail page.

4. Swipe from right to left on the right side of the screen to show the Super button, or press the Windows Logo +c key.

5, click the Share Super button to display the Shared pane.

6. Because Contoso Cookbook is not currently implementing a shared contract, the sharing pane informs you that "this application cannot be shared." ”

7, return to Visual Studio and stop Debugging.

Task 2– implement recipe sharing

Now that you have looked at the appearance of the shared pane when an application does not support sharing, let's add a shared contract to Contoso Cookbook. First, we need to add some infrastructure to support these contracts.

1. Open ItemDetailPage.xaml.cs and add the following using statement to the top of the file.

C#

Using Windows.ApplicationModel.DataTransfer;

Using System.Text;

Using Windows.Storage.Streams;

2, find the LoadState method and add the following statement at the end.

C#

Register for datarequested Events

Datatransfermanager.getforcurrentview (). datarequested + = ondatarequested;

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.