Editare

Partajați prin


PeerCollaboration.GetLocalRegisteredApplications Method

Definition

Gets a collection of PeerApplication objects that are registered on the local machine.

Overloads

GetLocalRegisteredApplications()

Gets all PeerApplication objects that are registered on the local machine.

GetLocalRegisteredApplications(PeerApplicationRegistrationType)

Gets a collection of all PeerApplication objects that are registered on the local machine for the specified PeerApplicationRegistrationType.

Examples

The following example code illustrates how to retrieve a collection of applications registered with the Collaboration infrastructure:

// Enumerating all local registered applications.
private static void EnumLocalRegisteredApplications()
{
    PeerApplicationCollection pac = null;
    Console.WriteLine("Attempting to enumerate all local registered collaboration applications...");
    try
    {
        pac = PeerCollaboration.GetLocalRegisteredApplications(PeerApplicationRegistrationType.AllUsers);
        foreach (PeerApplication pa in pac)
        {
            Console.WriteLine("Registered application:\n ID: {0}\n Description: {1}\n", pa.Id, pa.Description);
        }
    }
    catch (PeerToPeerException p2pEx)
    {
        Console.WriteLine("The Peer Collaboration Infrastructure could not return an enumeration of the registered applications: {0}",
            p2pEx.Message);
    }
    catch (Exception ex)
    {
        Console.WriteLine("Unexpected exception caught when trying to enumerate the registered collaboration applications: {0}.",
            ex.Message);
    }
    finally
    {
        foreach (PeerApplication pa in pac)
        {
            pa.Dispose();
        }
    }
    return;
}

Remarks

The caller required to sign in to the peer collaboration infrastructure via the SignIn method or prior to the use of this method.

Access to this property requires a PermissionState of Unrestricted. This state is created when the Peer collaboration session begins.

GetLocalRegisteredApplications()

Gets all PeerApplication objects that are registered on the local machine.

public:
 static System::Net::PeerToPeer::Collaboration::PeerApplicationCollection ^ GetLocalRegisteredApplications();
public static System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetLocalRegisteredApplications ();
static member GetLocalRegisteredApplications : unit -> System.Net.PeerToPeer.Collaboration.PeerApplicationCollection
Public Shared Function GetLocalRegisteredApplications () As PeerApplicationCollection

Returns

A PeerApplicationCollection that contains all applications that are registered on the local machine. If an application is not found, a collection of size zero (0) is returned.

Exceptions

An invalid value was returned when this method attempted to enumerate the application registered to this peer. Please make sure that all applications have valid registry values.

Remarks

The caller is required to sign-in to the peer collaboration infrastructure via the SignIn method prior to the use of this method.

Access to this property requires a PermissionState of Unrestricted. This state is created when the Peer collaboration session begins.

See also

Applies to

GetLocalRegisteredApplications(PeerApplicationRegistrationType)

Gets a collection of all PeerApplication objects that are registered on the local machine for the specified PeerApplicationRegistrationType.

public:
 static System::Net::PeerToPeer::Collaboration::PeerApplicationCollection ^ GetLocalRegisteredApplications(System::Net::PeerToPeer::Collaboration::PeerApplicationRegistrationType type);
[System.Security.SecurityCritical]
public static System.Net.PeerToPeer.Collaboration.PeerApplicationCollection GetLocalRegisteredApplications (System.Net.PeerToPeer.Collaboration.PeerApplicationRegistrationType type);
[<System.Security.SecurityCritical>]
static member GetLocalRegisteredApplications : System.Net.PeerToPeer.Collaboration.PeerApplicationRegistrationType -> System.Net.PeerToPeer.Collaboration.PeerApplicationCollection
Public Shared Function GetLocalRegisteredApplications (type As PeerApplicationRegistrationType) As PeerApplicationCollection

Parameters

type
PeerApplicationRegistrationType

PeerApplicationRegistrationType to return for the specified application.

Returns

A PeerApplicationCollection that contains all applications of the specified type that are registered on the local machine. If an application is not found, a collection of size zero (0) is returned.

Attributes

Exceptions

The type parameter is not set to a known value in the PeerApplicationRegistrationType enumeration.

An invalid value was returned when this method attempted to enumerate the application registered to this peer. Please make sure that all applications have valid registry values.

Remarks

The caller is required to sign-in to the Peer Collaboration infrastructure via the SignIn method prior to the use of this method.

Access to this method requires a PermissionState of Unrestricted. This state is created when the Peer collaboration session begins.

See also

Applies to