PeerApplication 类

定义

表示可在对等方协作基础结构中使用的应用程序。Represents an application that is available for use with the Peer Collaboration infrastructure.

public ref class PeerApplication : IDisposable, IEquatable<System::Net::PeerToPeer::Collaboration::PeerApplication ^>, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class PeerApplication : IDisposable, IEquatable<System.Net.PeerToPeer.Collaboration.PeerApplication>, System.Runtime.Serialization.ISerializable
type PeerApplication = class
    interface IDisposable
    interface IEquatable<PeerApplication>
    interface ISerializable
Public Class PeerApplication
Implements IDisposable, IEquatable(Of PeerApplication), ISerializable
继承
PeerApplication
属性
实现

注解

应用程序是一组可供终结点对等方使用的软件或软件功能。An application is a set of software or software features available to a peer from an endpoint. 通常,这是指启用网络的软件包,如游戏或其他协作应用程序。Commonly, this refers to network-enabled software packages such as games or other collaborative applications. PeerApplication 定义可用于 PeerCollaboration 网络的软件应用程序或组件集。A PeerApplication defines the set of software applications or components available for use with the PeerCollaboration network. 此网络使基础结构参与者可以启动此应用程序的使用情况。This network enables infrastructure participants to initiate usage of this application. 它们可以使用由此类标识的应用程序启动协作会话。They may initiate a collaboration session using the application identified by this class.

构造此类的实例并设置相应的属性后,可以在 System.Net.PeerToPeer 协作会话中使用此对象。After constructing an instance of this class and setting the appropriate properties, this object may be used in System.Net.PeerToPeer collaboration sessions. 它的用途是通过将它传递给对等协作 RegisterApplicationUnregisterApplication 方法来实现的,该方法将启用或禁用该方法。Its use is accomplished by passing it to the peer collaboration RegisterApplication and UnregisterApplication methods, which will enable or disable it.

必须先设置此实例的全局唯一 IdPeerApplicationRegistrationType 属性,然后才能成功注册该应用程序。The globally unique Id and PeerApplicationRegistrationType properties of this instance must be set before the application can successfully be registered.

向对等方协作基础结构注册应用程序之后,注册信息将保留在注册表中。After registering an application with the Peer Collaboration infrastructure, the registration information persists in the registry. 即使在注册了应用程序的程序退出后,也会使应用程序对协作应用程序可用。This makes the application available to collaboration applications even after the program which registered the application has exited.

在应用程序实例注册后更改其属性对注册没有影响。Changing the properties on an application instance after it has been registered has no effect on the registration. 若要更新注册,必须取消注册应用程序,然后再次注册该应用程序。To update the registration, the application must be unregistered and then registered again with the new information.

构造函数

PeerApplication()

初始化 PeerApplication 类型的新默认实例。Initializes a new default instance of the PeerApplication type.

PeerApplication(Guid, String, Byte[], String, String, PeerScope)

使用提供的应用程序 ID、说明、范围和数据元素初始化新的 PeerApplication 实例。Initializes a new PeerApplication instance with the supplied application ID, description, scope, and data elements.

PeerApplication(SerializationInfo, StreamingContext)

使用序列化所需的数据初始化 PeerApplication 类型的新实例。Initializes a new instance of the PeerApplication type with the data required for serialization.

属性

CommandLineArgs

获取或设置要在启动 PeerApplication 时使用的命令行参数。Gets or sets command-line parameters to use when initiating a PeerApplication.

Data

获取或设置与当前 PeerApplication 实例关联的数据。Gets or sets data associated with the current PeerApplication instance.

Description

获取或设置一个描述 String 的 Unicode PeerApplicationGets or sets a Unicode String that describes the PeerApplication.

Id

获取或设置与 Guid 关联的用户定义的 PeerApplicationGets or sets the user-defined Guid associated with the PeerApplication.

Path

获取或设置一个路径,该路径指定 PeerApplication 可执行文件在本地文件系统中的位置。Gets or sets the path that designates where the PeerApplication executable file resides on the local file system.

PeerScope

获取或设置在其中注册 PeerApplication 以进行协作的范围。Gets or sets the scope in which the PeerApplication is registered for collaboration.

SynchronizingObject

设置此属性值后,将在创建特定 SynchronizingObject 的线程上为因异步操作而未激发的所有事件回调关联的事件处理程序。When this property value is set, all events not fired as the result of an asynchronous operation will have the associated event handlers called back on the thread that created the specific SynchronizingObject.

方法

Dispose()

释放由 PeerApplication 对象使用的资源。Releases resources used by the PeerApplication object.

Dispose(Boolean)

释放由 PeerApplication 对象占用的非托管资源并(可选)释放托管资源。Releases the unmanaged resources used by the PeerApplication object and optionally releases the managed resources.

Equals(Object)

PeerApplication 与指定的 Object 进行比较。Compares the PeerApplication to the specified Object.

Equals(Object, Object)

确定指定的 PeerApplication 对象是否被视为相等。Determines whether the specified PeerApplication objects are considered equal.

Equals(PeerApplication)

PeerApplication 与指定的 PeerApplication 实例进行比较。Compares the PeerApplication to the specified PeerApplication instance.

GetHashCode()

返回 PeerApplication 实例的哈希代码。Returns the hash code for a PeerApplication instance.

GetObjectData(SerializationInfo, StreamingContext)

使用将目标 SerializationInfo 序列化所需的数据填充 PeerApplicationPopulates a SerializationInfo with the data needed to serialize the target PeerApplication.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnApplicationChanged(ApplicationChangedEventArgs)

引发 ApplicationChanged 事件。Raises the ApplicationChanged event.

ToString()

返回一个字符串,其中包含 Id 实例的 DescriptionPeerApplicationReturns a string that contains the Id and Description of the PeerApplication instance.

事件

ApplicationChanged

每当已订阅终结点上的远程对等方添加、更新或删除 PeerApplication 时,都将引发此事件。This event is raised whenever a PeerApplication is added, updated or deleted by a remote peer on a subscribed endpoint.

显式接口实现

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

实现 ISerializable 接口,并返回序列化目标 PeerApplication 所需的数据。Implements the ISerializable interface and returns the data required to serialize the target PeerApplication.

适用于

另请参阅