private async void PostPatientData(string fileName) { using (StreamReader reader = new StreamReader(fileName)) { this.statusTextBox.Text = "Reading patient data from the file..." + Environment.NewLine; var fileContent = reader.ReadToEnd(); var result = await this.GetTokenForConfidentialClient(); if (result != null) { this.statusTextBox.Text += "Getting ready to post data to the API" + Environment.NewLine; var httpClient = new HttpClient(); var apiCaller = new ProtectedApiCallHelper(httpClient); //var uri = String.IsNullOrEmpty(this.patientIDTextBox.Text) ? this._patientURI : this._patientURI + @"/" + this.patientIDTextBox.Text; await apiCaller.PostDataToAPIAsync(ConfigurationManager.AppSettings["BundleURI"], result.AccessToken, fileContent, Display); } } }