Imports System.Windows.Navigation
Imports ApNavSilverlightSvcAps.RefUsersRolesSvc

Partial Public Class Users
  Inherits Page

  Public Sub New()
    InitializeComponent()
  End Sub

  ' Se ejecuta cuando el usuario navega a esta página.
  Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs)
    Dim uriSvcUsersRoles As New Uri(Application.Current.Host.Source,
                                    "../Users/UsersRoles.svc")
    Dim svcUsersRoles As New UsersRolesClient(
      "CustomBinding_UsersRoles", uriSvcUsersRoles.AbsoluteUri)
    AddHandler svcUsersRoles.UsersCompleted,
      AddressOf svcUsersRoles_UsersCompleted
    svcUsersRoles.UsersAsync()
  End Sub

  Private Sub svcUsersRoles_UsersCompleted(sender As Object, e As UsersCompletedEventArgs)
    Dim ls As List(Of String) = e.Result.ToList()
    lstUsers.ItemsSource = ls
  End Sub
End Class
