private void cbProceso_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender != null) { if (cbProceso.SelectedItem != null) { if (!CargaItemsViewModel.IsRunning) { DlgUpload ds = new DlgUpload(); CargaItemsViewModel viewModel = (this.DataContext as ObjectDataProvider).Data as CargaItemsViewModel; if (viewModel != null) { viewModel.SetCargaItemsViewModel(); ds.DataContext = viewModel; ds.Owner = Application.Current.Windows[0]; viewModel.start(); ds.ShowDialog(); } } } } }
private void treeView1_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { if (Application.Current.Windows[0] != null) { DlgUpload ds = new DlgUpload(); ds.Owner = Application.Current.Windows[0]; try { CargaItemsViewModel viewModel = (ds.Owner.DataContext as MainWindowViewModel).CurrentPageViewModel as CargaItemsViewModel; if (viewModel != null) { viewModel.SetCargaItemsMenuViewModel(); ds.DataContext = viewModel; viewModel.start(); ds.ShowDialog(); } } catch (Exception ex) { } } }