private void btIncluir_Click(object sender, RoutedEventArgs e) { try { EstoqueContagemDetalheDTO detalheDTO = new EstoqueContagemDetalheDTO(); detalheDTO.IdEstoqueContagemCabecalho = ((EstoqueContagemCabecalhoViewModel)DataContext).EstoqueContagemCabecalhoSelected.Id; ((EstoqueContagemCabecalhoViewModel)DataContext).EstoqueContagemDetalheSelected = detalheDTO; EstoqueContagemDetalhe viewDetalhe = new EstoqueContagemDetalhe(); 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 (((EstoqueContagemCabecalhoViewModel)DataContext).EstoqueContagemDetalheSelected != null) { tabDetalhe.IsSelected = true; EstoqueContagemDetalhe viewDetalhe = new EstoqueContagemDetalhe(); 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; } }