// [START authgreet] /// <summary>Auth Greets the user using the Hello World service.</summary> private async void AuthGreet_Click(object sender, RoutedEventArgs e) { // Get or create the user credentials. var credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( new ClientSecrets { ClientId = ClientSecretsConsts.ClientId, ClientSecret = ClientSecretsConsts.ClientSecret, }, new[] { HelloworldService.Scope.UserinfoEmail }, "user", CancellationToken.None); // Create the service. var service = new HelloworldService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = "Endpoints Sample", }); // Execute the request. var response = await service.Greetings.Authed().ExecuteAsync(); // Update a UI control with the response. ResponseTextBlock.Text = response.Message; }
// [END list] // [START greet] /// <summary>Greets the user using the Hello World service.</summary> private async void Greet_Click(object sender, RoutedEventArgs e) { var service = new HelloworldService(new BaseClientService.Initializer() { ApplicationName = "Endpoints Sample", }); var response = await service.Greetings.GetGreeting(0).ExecuteAsync(); ResponseTextBlock.Text = response.Message; }
// [END authgreet] // [START list] /// <summary>Lists all the Hello World's greetings.</summary> private async void List_Click(object sender, RoutedEventArgs e) { // [START service] // Create the service. var service = new HelloworldService(new BaseClientService.Initializer() { ApplicationName = "Endpoints Sample", }); // [END service] // [START execute] // Execute the request to list all greetings. var response = await service.Greetings.ListGreeting().ExecuteAsync(); // [END execute] // Update a UI control with the response. ResponseTextBlock.Text = String.Join(Environment.NewLine, from item in response.Items select item.Message); }