// Kills the selected query async Task KillQuery() { try { if (listView.SelectedItems.Count == 0) { return; } var pid = ((InfluxDbRunningQuery)listView.SelectedItems[0].Tag).PID; var response = await InfluxDbClient.KillQueryAsync(pid); if (!response.Success && !response.Body.Contains("query interrupted")) { AppForm.DisplayError(response.Body); } else { listView.BeginUpdate(); listView.SelectedItems[0].Remove(); listView.EndUpdate(); } UpdateUIState(); } catch (Exception ex) { AppForm.DisplayException(ex); } }