private void btIncluir_Click(object sender, RoutedEventArgs e) { try { TributCofinsCodApuracaoDTO detalheDTO = new TributCofinsCodApuracaoDTO(); detalheDTO.IdTributConfiguraOfGt = ((TributConfiguraOfGtViewModel)DataContext).TributConfiguraOfGtSelected.Id; ((TributConfiguraOfGtViewModel)DataContext).TributCofinsCodApuracaoSelected = detalheDTO; TributCofinsCodApuracao viewDetalhe = new TributCofinsCodApuracao(); viewDetalhe.btSair.Click += new RoutedEventHandler(btSair_Click); viewDetalhe.btGravar.Click += new RoutedEventHandler(btGravar_Click); tabDetalhe.Content = viewDetalhe; tabDetalhe.IsSelected = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Alerta do sistema"); } }
private void btConsultar_Click(object sender, RoutedEventArgs e) { try { if (((TributConfiguraOfGtViewModel)DataContext).TributCofinsCodApuracaoSelected != null) { tabDetalhe.IsSelected = true; TributCofinsCodApuracao viewDetalhe = new TributCofinsCodApuracao(); viewDetalhe.btSair.Click += new RoutedEventHandler(btSair_Click); viewDetalhe.btGravar.Click += new RoutedEventHandler(btGravar_Click); tabDetalhe.Content = viewDetalhe; } else { MessageBox.Show("Selecione um elemento na lista.", "Alerta do sistema"); } } catch (Exception ex) { throw ex; } }