private void btIncluir_Click(object sender, RoutedEventArgs e) { try { TributIpiDipiDTO detalheDTO = new TributIpiDipiDTO(); detalheDTO.IdTributConfiguraOfGt = ((TributConfiguraOfGtViewModel)DataContext).TributConfiguraOfGtSelected.Id; ((TributConfiguraOfGtViewModel)DataContext).TributIpiDipiSelected = detalheDTO; TributIpiDipi viewDetalhe = new TributIpiDipi(); 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).TributIpiDipiSelected != null) { tabDetalhe.IsSelected = true; TributIpiDipi viewDetalhe = new TributIpiDipi(); 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; } }