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";
            }
        }
Beispiel #2
0
        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);
            }
        }