private async void Start_Click(object sender, RoutedEventArgs e) { Helpers.ScenarioStarted(StartButton, CancelButton, OutputField); rootPage.NotifyUser("In progress", NotifyType.StatusMessage); try { // 'AddressField' is a disabled text box, so the value is considered trusted input. When enabling the // text box make sure to validate user input (e.g., by catching FormatException as shown in scenario 1). Uri resourceAddress = new Uri(AddressField.Text); IHttpContent jsonContent = new HttpJsonContent(JsonValue.Parse("{\"score\": 100, \"enabled\": false}")); HttpResponseMessage response = await httpClient.PostAsync(resourceAddress, jsonContent).AsTask(cts.Token); await Helpers.DisplayTextResultAsync(response, OutputField, cts.Token); rootPage.NotifyUser("Completed", NotifyType.StatusMessage); } catch (TaskCanceledException) { rootPage.NotifyUser("Request canceled.", NotifyType.ErrorMessage); } catch (Exception ex) { rootPage.NotifyUser("Error: " + ex.Message, NotifyType.ErrorMessage); } finally { Helpers.ScenarioCompleted(StartButton, CancelButton); } }