private void _ButtonNewSave_Click(object sender, EventArgs e) { Account account = new Account(_TextUsername.Text, _TextPassword.Text); if (_ButtonAccounts.ButtonItems.Count == 0) { account.Default = true; } SkipeButtonItem item = new SkipeButtonItem() { ButtonText = account.FullAddress, AssociatedPanel = new AccountPanel() { Account = account, ControlBackColor = _PanelAccounts.ControlBackColor } }; Config.Current.Accounts.Add(account); Config.Current.Save(); this.Controls.Add(item.AssociatedPanel); InitPanelShapes(item.AssociatedPanel); item.AssociatedPanel.BringToFront(); _ButtonAccounts.ButtonItems.Add(item); _PanelNewAccount.Hide(); _TextUsername.Text = String.Empty; _TextPassword.Text = String.Empty; _PictureExclamation.Visible = _LabelError.Visible = false; }
private void InitAccounts() { foreach (Account account in Config.Current.Accounts) { SkipeButtonItem item = new SkipeButtonItem() { ButtonText = account.FullAddress, AssociatedPanel = new AccountPanel() { Account = account, ControlBackColor = _PanelAccounts.ControlBackColor } }; InitPanelShapes(item.AssociatedPanel); item.AssociatedPanel.Hide(); this.Controls.Add(item.AssociatedPanel); item.AssociatedPanel.BringToFront(); if (account.Default) { item.Font = new Font(item.Font, FontStyle.Bold); } _ButtonAccounts.ButtonItems.Add(item); } }