private async void BtPatch_Click(object sender, RoutedEventArgs e) { body = Panel.Text; InvDetId = TbInvDetId.Text; //var bodyPM = JObject.Parse(panel.Text); try { await Task.Run(() => { var request = new PatchRequest(); request.SendRequest(body, InvDetId); MessageBox.Show(request.statusCode, "Status Code"); }); } catch (Exception err) { if (err != null) { Panel.Text = err.ToString(); } } }