TransferTargetWatcher.TransferToAsync(TransferTarget, WindowId) 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.
The TransferToAsync method asynchronously invokes a transfer target with the specified data package. This method facilitates the sharing of content to a selected target.
public:
virtual IAsyncOperationWithProgress<TransferTargetInvokeResult ^, double> ^ TransferToAsync(TransferTarget ^ target, WindowId parentWindowHandle) = TransferToAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<TransferTargetInvokeResult, double> TransferToAsync(TransferTarget const& target, WindowId const& parentWindowHandle);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<TransferTargetInvokeResult,double> TransferToAsync(TransferTarget target, WindowId parentWindowHandle);
function transferToAsync(target, parentWindowHandle)
Public Function TransferToAsync (target As TransferTarget, parentWindowHandle As WindowId) As IAsyncOperationWithProgress(Of TransferTargetInvokeResult, Double)
Parameters
- target
- TransferTarget
The TransferTarget to which the data package will be transferred. This parameter specifies the destination for the sharing operation.
- parentWindowHandle
- WindowId
A WindowId that represents the parent window handle. This parameter is used to associate the sharing operation with a specific window.
Returns
IAsyncOperationWithProgress<TransferTargetInvokeResult,Double>
IAsyncOperationWithProgress<TransferTargetInvokeResult,double>
An IAsyncOperationWithProgress<TransferTargetInvokeResult, double> that represents the asynchronous operation. The result indicates whether the transfer was successful, and the progress provides updates on the operation's status.
- Attributes
Examples
Example: Invoking a Transfer Target Asynchronously
var result = await watcher.TransferToAsync(target, parentWindowHandle);
if (result.Succeeded)
{
Console.WriteLine("Transfer succeeded.");
}
else
{
Console.WriteLine($"Transfer failed with error: {result.ExtendedError}");
}
Remarks
The TransferToAsync method is used to share content with a transfer target. Applications can use this method to initiate sharing operations and monitor their progress.
Usage Notes:
- Ensure that the
targetparameter is valid and enabled before calling this method. - Handle the result of the operation to determine whether the transfer was successful.