TransferTargetWatcher.Added Event
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 Added event occurs when a new transfer target is discovered by the TransferTargetWatcher. This event provides details about the added target through the TransferTargetChangedEventArgs.
/// [Windows.Foundation.Metadata.Experimental]
/// [add: Windows.Foundation.Metadata.Experimental]
/// [remove: Windows.Foundation.Metadata.Experimental]
// Register
event_token Added(TypedEventHandler<TransferTargetWatcher, TransferTargetChangedEventArgs const&> const& handler) const;
// Revoke with event_token
void Added(event_token const* cookie) const;
// Revoke with event_revoker
TransferTargetWatcher::Added_revoker Added(auto_revoke_t, TypedEventHandler<TransferTargetWatcher, TransferTargetChangedEventArgs const&> const& handler) const;
[Windows.Foundation.Metadata.Experimental]
[add: Windows.Foundation.Metadata.Experimental]
[remove: Windows.Foundation.Metadata.Experimental]
public event TypedEventHandler<TransferTargetWatcher,TransferTargetChangedEventArgs> Added;
function onAdded(eventArgs) { /* Your code */ }
transferTargetWatcher.addEventListener("added", onAdded);
transferTargetWatcher.removeEventListener("added", onAdded);
- or -
transferTargetWatcher.onadded = onAdded;
Public Custom Event Added As TypedEventHandler(Of TransferTargetWatcher, TransferTargetChangedEventArgs)
Event Type
- Attributes
Examples
Example: Handling the Added Event
watcher.Added += (sender, args) =>
{
Console.WriteLine($"New target added: {args.Target.Label}");
};
Remarks
Applications can handle the Added event to dynamically respond to the discovery of new transfer targets. This is useful for updating the user interface or initiating actions based on the newly available targets.
Event Arguments:
TransferTargetChangedEventArgs: Contains information about the added transfer target.