public MainWindow() { InitializeComponent(); if (!DataAccess.CheckDBExists()) { DataAccess.CreateDB(); var factory = new DBTableCreator(true); if (factory.Created == false) { MessageBox.Show("Failed to create tables"); } } //Apply Profile list to a dropdown list var Populater = new ListPopulaters(); Populater.PopulateProfileList(DDLProfileList); if (!CheckedSettings) { var applied = SettingSerialization.ReadSettings(); if (!(applied.DefaultProfile is null)) { foreach (ComboBoxItem item in DDLProfileList.Items) { if (item.Content.ToString() == applied.DefaultProfile.ProfileName) { DDLProfileList.SelectedItem = item; Profile = applied.DefaultProfile; } } } CheckedSettings = true; } if (DDLProfileList.Items.Count < 2) { PrimaryFrame.Navigate(new Uri("StarterPage.xaml", UriKind.RelativeOrAbsolute)); LoadedPage = "Starter"; } if (DDLProfileList.SelectedIndex > 0) { PrimaryFrame.Navigate(new Uri("DefaultPage.xaml", UriKind.RelativeOrAbsolute)); LoadedPage = "Default"; } }
private void BtnChangePage_Click(object sender, RoutedEventArgs e) { if (!(Profile is null)) { if (LoadedPage == "Default") { PrimaryFrame.Navigate(new Uri("SecondPage.xaml", UriKind.RelativeOrAbsolute)); LoadedPage = "Second"; } else { PrimaryFrame.Navigate(new Uri("DefaultPage.xaml", UriKind.RelativeOrAbsolute)); LoadedPage = "Default"; } }