public MainWindow() { InitializeComponent(); this.WindowStartupLocation = WindowStartupLocation.CenterScreen; this.StateChanged += new EventHandler(MainWindow_StateChanged); accueilPage = new AccueilPage(); MainFrame.NavigationService.Navigate(accueilPage); }
private void BTN_Navigate_Click(object sender, RoutedEventArgs e) { Page pageToNavigate; Button clickedButton = sender as Button; // Accueil if (clickedButton.Name == BTN_accueil.Name) { pageToNavigate = (accueilPage = accueilPage ?? new AccueilPage()); } // Planning else if (clickedButton.Name == BTN_planning.Name) { pageToNavigate = (accueilPlanningPage = accueilPlanningPage ?? new AccueilPlanningPage()); } // Formation else if (clickedButton.Name == BTN_formations.Name) { pageToNavigate = (accueilFormationPage = accueilFormationPage ?? new AccueilFormationPage()); } // Formateur else if (clickedButton.Name == BTN_formateurs.Name) { pageToNavigate = (accueilFormateurPage = accueilFormateurPage ?? new AccueilFormateurPage()); } // Apprenant else if (clickedButton.Name == BTN_apprenants.Name) { pageToNavigate = (accueilApprenantPage = accueilApprenantPage ?? new AccueilApprenantPage()); } // Salle else if (clickedButton.Name == BTN_salles.Name) { pageToNavigate = (accueilLieuPage = accueilLieuPage ?? new AccueilLieuPage()); } // Materiel else if (clickedButton.Name == BTN_materiels.Name) { pageToNavigate = (accueilMaterielPage = accueilMaterielPage ?? new AccueilMaterielPage()); } // Facturation else if (clickedButton.Name == BTN_facturation.Name) { pageToNavigate = (accueilFacturationPage = accueilFacturationPage ?? new AccueilFacturationPage()); } // Paramètre else if (clickedButton.Name == BTN_parametres.Name) { pageToNavigate = (accueilParametrePage = accueilParametrePage ?? new AccueilParametrePage()); } // Autres else { throw new Exception("Impossible de naviguer vers une page depuis le bouton : [" + clickedButton.Name + "].") { } }; MainFrame.NavigationService.Navigate(pageToNavigate); SetColorButtonMenu(clickedButton); }