private void DgOperation_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { if (dgOperation.SelectedItems.Count > 0) { var operations = dgOperation.SelectedItem as MA_Operations; if (operations != null) { txtOperation.Text = operations.Operation; description = operations.Description; txtCostOperation.Text = Math.Round(Convert.ToDouble(operationService.GetOpTotalCost(operations.Operation)), 2).ToString(); ShowFieldsHidden(operations.Operation, operations.WC); } string obs = operationService.GetOperationNotes(operations.Operation); if (!string.IsNullOrEmpty(obs)) { txtObs.Text = obs; } else { txtObs.Text = string.Empty; } } }catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message + "\n " + ex.StackTrace, "Erro", MessageBoxButton.OK, MessageBoxImage.Error); } }