public Login() { InitializeComponent(); StartPosition = FormStartPosition.CenterScreen; AcceptButton = btnLogin; DefaultPokemonService = new Pokemon.PokemonService(); string path = Path.Combine(Application.UserAppDataPath, "\\accounts.json"); try { string json = System.IO.File.ReadAllText(path); DefaultAccountService = JsonConvert.DeserializeObject <AccountService>(json); } catch (Exception e) { DefaultAccountService = new AccountService(); } DefaultAccounts[0] = new Account("admin", BCryptHelper.HashPassword("admin", BCryptHelper.GenerateSalt())); foreach (Account a in DefaultAccounts) { if (a != null) { DefaultAccountService.createAccount(a.Username, a); } } }
public Dex(Account account, Pokemon.PokemonService service) { InitializeComponent(); DefaultPokemonService = service; StartPosition = FormStartPosition.CenterScreen; Text = "PokeC - " + account.Username; ActiveControl = txtSearch; }