Sie sind auf Seite 1von 14

C4F Vista P2P Developer Kit 2008

Picture Quick Start

Table of Contents
Introduction

Overview

How to Use the Component

Table of Figures
Figure 1: New Visual C# and Visual Basic Windows Form Application

Figure 2: The Toolbox pane

Figure 3: NetworkManager on the design surface

Figure 4: NetworkManager and PictureControl on the design surface

Figure 5: NetworkManager SmartTag

Figure 6: Selecting the Picture Control

Figure 7: Joining the application to a network

Figure 8: Windows Firewall Security Alert

Figure 9: Sending a picture to other users on the network

Figure 10: Two instances of the application connected to the same network

Introduction
This Peer to Peer (P2P) sample application demonstrates many of the ways to use
the new Peer Channel technology. Peer Channel is part of Windows Communication
Foundation (WCF), which makes it possible to join hundreds of computers to a P2P
network.
Peer Channel is inherently a multicast channel, so data sent by one node is received
by all nodes in the network. Peer Channel reduces the complexity of creating and
joining networks, and maintaining an appropriate number of connections between
nodes. It also automatically handles additional complexities, such as nodes leaving
the network and causing the network to divide, so it’s much easier to build
applications that include collaboration and sharing data between computers.

Overview
This document demonstrates how to use the C4F P2P components to build a picture
sharing application that uses P2P to send pictures from one computer to another.

How to Use the Component


Before you can create a P2P Windows Form picture application, you must have the
following programs installed on your computer:

• Microsoft Visual Basic 2008 Express Edition or Microsoft Visual C# 2008


Express Edition

• .Net 3.5 or higher

• C4F Vista P2P Developer Kit

To create a P2P Windows Form picture application


1. Create Windows Application project.
a. Open File Menu à New à Project
b. Select Windows Forms Application from Templates pane.

Visual Basic
Figure 1: New Visual C# and Visual Basic Windows Form Application

2. Click View, and then click Toolbox.

3. In the Toolbox pane, click the plus sign (+) next to C4F Vista P2P Tools
(WinForms) to expand the group.
Figure 2: The Toolbox pane

4. Select NetworkManager and drag it to the design surface.

Note If the tool doesn’t fit on the design surface, drag the edges of the
design surface to resize it.
Figure 3: NetworkManager on the design surface

5. Select PictureControl and drag it to the design surface.


Figure 4: NetworkManager and PictureControl on the design surface

6. On the design surface, click NetworkManager to select it, and then open the
SmartTag by clicking the arrow in the upper right corner of the tool.
Figure 5: NetworkManager SmartTag

7. In the NetworkManager Tasks dialog box, click the arrow next to the
Picture Control drop-down list, and then select PictureControl1.
Figure 6: Selecting the Picture Control

8. Press F5 to debug the application.

9. In the application window, enter a user name, password, and network name,
and then click Join.
Figure 7: Joining the application to a network

Note Windows Firewall might block this application. To unblock the


application, click Unblock in the Windows Security Alert dialog box.
Figure 8: Windows Firewall Security Alert

10.When the application is joined to a network, the status bar in


NetworkManager reads Connected. To send a picture to other users on the
network, click Select Picture to Send, and then browse to and select a
picture to send.
Figure 9: Sending a picture to other users on the network

Note If you are the only user joined to the network, you can test the
connection by opening another instance of the application and joining both
instances to the same network. For more information, see To test the
connection of a P2P Windows Form picture application.

To test the connection of a P2P Windows Form picture


application
1. Press F5 to debug the application.

2. In the application window, type a user name, password, and network name,
and then click Join.
3. Open Windows Explorer and browse to the location that the project being is
saved in (for example, C:\code\p2p). Open the project folder, open the bin
folder, open the Debug folder, and then double-click the executable.

4. In the second application window, type a user name, password, and network
name, and then click Join.

Note To join both instances of the application to the same network, you
must use the same password and network name.

5. In the first application window, click Select Picture to Send, and then
browse to and select a picture to send. The picture appears in the in the
second application window.
Figure 10: Two instances of the application connected to the same network

Das könnte Ihnen auch gefallen