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"; } }
public AdjustSettingsWindow() { InitializeComponent(); var populater = new ListPopulaters(); populater.PopulateProfileList(DDLDefaultProfile); populater.PopulateOverviewTableList(DDLDefaultOverviewTable); var applied = SettingSerialization.ReadSettings(); ApplySettings(applied); }
public DefaultPage() { InitializeComponent(); var Main = (MainWindow)Application.Current.MainWindow; Profile = Main.Profile; //Apply the default table setting var saved = SettingSerialization.ReadSettings(); if (saved.DefaultOverviewTable != OverviewTable.None) { ChangeGrids(saved.DefaultOverviewTable); } else { ChangeGrids(OverviewTable.Accounts); } }
private void BtnSaveSettings_Click(object sender, RoutedEventArgs e) { var Settings = new ApplicationSettings(); if (DDLDefaultProfile.SelectedIndex > 0) { Settings.DefaultProfile = new Profile(((ComboBoxItem)DDLDefaultProfile.SelectedItem).Content.ToString()); } if (DDLDefaultOverviewTable.SelectedIndex <= 0) { Settings.DefaultOverviewTable = OverviewTable.None; } else { Settings.DefaultOverviewTable = (OverviewTable)Convert.ToInt32(((ComboBoxItem)DDLDefaultOverviewTable.SelectedItem).Tag); } SettingSerialization.SaveSettings(Settings); Close(); }