private async void btnDeleteSoftware_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show( "Do you really want to delete this software? \n All licenses of this software will deleted too.", "Are you sure?", MessageBoxButton.YesNo ); if (result == MessageBoxResult.No) { return; } bool success = false; using (var client = new SoftwaresClient(Global.Properties.BaseUrl)) { // TODO get software id from anywhere else success = await client.DeleteSoftware(((SoftwareDto)lst1.SelectedItem).Id); } if (!success) { return; } Thread.Sleep(1000); RefreshData(); }