Skip to content

Latest commit

 

History

History
105 lines (74 loc) · 3.65 KB

RemoteDeviceHelper.md

File metadata and controls

105 lines (74 loc) · 3.65 KB
title author description keywords dev_langs
RemoteDeviceHelper
avknaidu
The RemoteDeviceHelper is a Helper to get a List Remote Devices that are accessible.
windows 10, uwp, windows community toolkit, uwp community toolkit, uwp toolkit, RemoteDeviceHelper, helper
csharp

RemoteDeviceHelper

The RemoteDeviceHelper gives you a list of Remote Systems. All the systems must be signed in with the same Microsoft Account (MSA)

Important

Make sure you enable the RemoteSystem capability in your app's package.appxmanifest to access remote system information.

[!div class="nextstepaction"] Try it in the sample app

Syntax

RemoteDeviceHelper _remoteDeviceHelper = new RemoteDeviceHelper();

You can also use default filter types for initializing. Like Below.

var filters = new List<IRemoteSystemFilter>
{
    new RemoteSystemDiscoveryTypeFilter(RemoteSystemDiscoveryType.Cloud),
    new RemoteSystemAuthorizationKindFilter(RemoteSystemAuthorizationKind.SameUser),
    new RemoteSystemStatusTypeFilter(RemoteSystemStatusType.Available)
};

RemoteDeviceHelper _remoteDeviceHelper = new RemoteDeviceHelper(filters);

Example

// without filters

RemoteDeviceHelper _remoteDeviceHelper = new RemoteDeviceHelper();
DevicesList.DataContext = _remoteDeviceHelper;


// with filters

var filters = new List<IRemoteSystemFilter>
{
    new RemoteSystemDiscoveryTypeFilter(RemoteSystemDiscoveryType.Cloud),
    new RemoteSystemAuthorizationKindFilter(RemoteSystemAuthorizationKind.SameUser),
    new RemoteSystemStatusTypeFilter(RemoteSystemStatusType.Available)
};

RemoteDeviceHelper _remoteDeviceHelper = new RemoteDeviceHelper(filters);
DevicesList.DataContext = _remoteDeviceHelper;
<ListView ItemsSource="{Binding RemoteSystems}" x:Name="DevicesList">
  <ListView.ItemTemplate>
    <DataTemplate>
      <Grid>
        <Grid.RowDefinitions>
          <RowDefinition Height="*"/>
          <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <TextBlock Text="{Binding DisplayName}" Tag="{Binding }" Grid.Row="0" />
        <TextBlock Text="{Binding ModelDisplayName}" Tag="{Binding }" Grid.Row="1" />
      </Grid>
    </DataTemplate>
  </ListView.ItemTemplate>
</ListView>

Sample Project

RemoteDeviceHelper Sample Page Source. You can see this in action in the Windows Community Toolkit Sample App.

Requirements

Device family Universal, 10.0.16299.0 or higher
Namespace Microsoft.Toolkit.Uwp.Helpers
NuGet package Microsoft.Toolkit.Uwp

API

Related Topics