LegacyGipGameControllerProvider.ClearPairing(User, String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Removes any copilot pairings for controllerId for the given user.
public:
static void ClearPairing(User ^ user, Platform::String ^ controllerProviderId);
static void ClearPairing(User const& user, winrt::hstring const& controllerProviderId);
public static void ClearPairing(User user, string controllerProviderId);
function clearPairing(user, controllerProviderId)
Public Shared Sub ClearPairing (user As User, controllerProviderId As String)
Parameters
- user
- User
User to clear the pairing for.
- controllerProviderId
-
String
Platform::String
winrt::hstring
Provider id for the controller to remove from parings.
Examples
public void CopilotSample(GipGameControllerProvider pilotProvider,
GipGameControllerProvider copilotProvider)
{
// Establish a copilot pairing for the given pilot and copilot providers
string pilotId = GameControllerProviderInfo.GetProviderId(pilotProvider);
string copilotId = GameControllerProviderInfo.GetProviderId(copilotProvider);
User user = User.GetDefault();
LegacyGipGameControllerProvider.PairPilotToCopilot(user, pilotId,
copilotId);
// Read copilot properties
LegacyGipGameControllerProvider.IsPilot(user, pilotId); // Returns copilotId
LegacyGipGameControllerProvider.IsPilot(user, copilotId); // Returns null
LegacyGipGameControllerProvider.IsCopilot(user, pilotId); // Returns null
LegacyGipGameControllerProvider.IsCopilot(user, copilotId); // Returns pilotId
// Removes the pairing for both controllers
LegacyGipGameControllerProvider.ClearPairing(user, pilotId);
// Also removes the pairing for both controllers (unnecessary since the pairing was already removed)
LegacyGipGameControllerProvider.ClearPairing(user, copilotId);
}
Remarks
Removes the given controller from any pairings where it is either a pilot or copilot for the given user. The controller does not need to be connected to be unpaired. Removing one controller from a pairing removes the pairing entirely — that is, if a controller is paired as a copilot to another controller, removing the copilot controller will also remove the pairing for the pilot controller and vice versa.
Caution
Copilot pairing is system-wide and persistent for the given user. This should only be done at the user's direction.