public void NewAccountCreated(object sender, NewAccountCreatedArgs e) { int acctID = currentGame.GetLowestEmptyAccountID(); int returnID; if (e.returnAcc == -1) { returnID = acctID; } else if (e.returnAcc == -2) { returnID = -1; } else { returnID = e.returnAcc; } Account tempAccount = new Account(acctID, e.type, e.investment, e.nick, e.owner, returnID); currentGame.accounts.Add(tempAccount); currentGame.characters.Find(x => x.ID == e.owner).AddAccountAccess(tempAccount); currentGame.accounts.Sort(); CharacterSelected(); needToSave = true; }
public NewAccount(List <Character> allCharacters, int selectedID, List <Account> allAccounts, string[] i_accountTypes) { args = new NewAccountCreatedArgs(); reinvest = false; InitializeComponent(); allCharas = allCharacters.ToArray(); foreach (Character chara in allCharacters) { cb_accountOwner.Items.Add(chara.name); } cb_accountOwner.SelectedIndex = selectedID; allAccount = allAccounts.ToArray(); cb_reinvestAccount.Items.Add("This Account"); foreach (Account acc in allAccounts) { cb_reinvestAccount.Items.Add(acc.GetAccountName()); } accountTypes = i_accountTypes; cb_accountType.Items.AddRange(i_accountTypes); }
public virtual void OnNewAccountCreated(NewAccountCreatedArgs e) { EventHandler <NewAccountCreatedArgs> handler = NewAccountCreated; handler?.Invoke(this, e); }