public MainWindow(PageViewModel viewModel, User user) { InitializeComponent(); //Instantiate Viewmodel MainViewModel = viewModel; DataContext = MainViewModel; thisUser = user; using (var context = new DbmejiaEntities()) { try { context.Database.Connection.Open(); context.Database.Connection.Close(); } catch (SqlException e) { MessageBox.Show("Verifica tus servicios de base de datos"); this.Close(); } } //Pagina Inicial var PaginaEstadisticas = new Views.PageEstadisticas(); ContentMain.Navigate(PaginaEstadisticas); }
//Change content usercontrol from sidebar menu private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Change usercontrol switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "ItemClients": MainViewModel.UpdateClients(10); var PaginaClientes = new Views.PageClientes(MainViewModel); ContentMain.Navigate(PaginaClientes); break; case "ItemProducts": MainViewModel.UpdateProducts(10); var PaginaProductos = new Views.PageProducts(MainViewModel, thisUser); ContentMain.Navigate(PaginaProductos); break; case "ItemSales": MainViewModel.UpdateVentas(10); var PaginaVentas = new Views.PageVentas(MainViewModel); ContentMain.Navigate(PaginaVentas); break; case "ItemImports": MainViewModel.UpdateImportacion(10); var PaginaImportaciones = new Views.PageImportaciones(MainViewModel, thisUser); ContentMain.Navigate(PaginaImportaciones); break; case "ItemPedidos": MainViewModel.UpdatePedido(10); var PaginaPedidos = new Views.PagePedidos(MainViewModel, thisUser); ContentMain.Navigate(PaginaPedidos); break; case "ItemStats": ContentMain.Navigate(new Views.PageEstadisticas()); break; case "ItemReports": ContentMain.Navigate(new Views.PageReportes(MainViewModel)); break; case "ItemBackup": ContentMain.Navigate(new Views.PageBackup(MainViewModel)); break; default: break; } }
public MainWindow(PageViewModel viewModel, User user) { InitializeComponent(); //Instantiate Viewmodel MainViewModel = viewModel; DataContext = MainViewModel; thisUser = user; //Pagina Inicial //var PaginaEstadisticas = new Views.PageEstadisticas(); ContentMain.Navigate(new Pages.HomePage()); }
private void Button_Click(object sender, RoutedEventArgs e) { ContentMain.Navigate(new Pages.HomePage()); }