private void BtnAddLine_Click(object sender, RoutedEventArgs e) { try { var line = new LineInput(); var form = new ItemForm(line); form.Closed += Form_Closed; form.ShowDialog(); } catch (Exception ex) { FormHelper.MessageError(ex); } }
private void BtnUpdateLine_Click(object sender, RoutedEventArgs e) { try { var line = gridLines.SelectedItem as LineInput; if (line is null) { throw new Exception("Nenhuma linha selecionada"); } var form = new ItemForm(line); form.ShowDialog(); var lineToUpdated = Lines.FirstOrDefault(c => line.Id.Equals(c.Id)); lineToUpdated = line; } catch (Exception ex) { FormHelper.MessageError(ex); } }