public void loadAll() { if (SavGremlin.Properties.Settings.Default.Categories != null) { foreach (String cat in SavGremlin.Properties.Settings.Default.Categories) { SavingsCategoryControl tmp = new SavingsCategoryControl(); tmp.newTransactionButton.Click += new EventHandler(this.onNewTransaction); tmp.savData = SavingsCategory.inflateFromString(cat); tmp.refreshViews(); tmp.Dock = DockStyle.Left; savingsCategoryPanel.Controls.Add(tmp); } } if (SavGremlin.Properties.Settings.Default.Accounts != null) { foreach (String cat in SavGremlin.Properties.Settings.Default.Accounts) { SavingsAccountControl tmp = new SavingsAccountControl(); tmp.addButton.Click += new EventHandler(this.onNewAccountAddition); tmp.data = SavingsAccount.inflateFromString(cat); tmp.refreshViews(); tmp.Dock = DockStyle.Left; accountsPanel.Controls.Add(tmp); } } }
private void newAccountToolStripMenuItem_Click(object sender, EventArgs e) { NewAccountForm form = new NewAccountForm(); if (form.ShowDialog() == DialogResult.OK) { SavingsAccountControl tmp = new SavingsAccountControl(); tmp.data = form.newAccount; tmp.Dock = DockStyle.Left; tmp.refreshViews(); accountsPanel.Controls.Add(tmp); saveAll(); } }