Ejemplo n.º 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var accc = new Accounts
            {
                Login = textBox1.Text,
                Token = token,
                Site  = textBox3.Text
            };

            var list = new List <Accounts>();

            if (File.Exists(acc_file))
            {
                list = accountList.accounts;
                list.Add(accc);
            }
            else
            {
                list.Add(accc);
            }
            accountList = new AccountList
            {
                accounts = list
            };


            var out_accountList = JsonConvert.SerializeObject(accountList);

            File.WriteAllText(acc_file, out_accountList);
            RefreshAccounts();
        }
Ejemplo n.º 2
0
 void RefreshAccounts()
 {
     if (File.Exists(acc_file))
     {
         listBox1.Items.Clear();
         //FileStream fstr = new FileStream("accounts.json", FileMode.Open);
         var json = File.ReadAllText(acc_file);
         accountList = JsonConvert.DeserializeObject <AccountList>(json);
         foreach (var acc in accountList.accounts)
         {
             listBox1.Items.Add(acc.Login);
         }
     }
 }
Ejemplo n.º 3
0
 void RefreshAccounts()
 {
     if (File.Exists(acc_file))
     {
         //FileStream fstr = new FileStream("accounts.json", FileMode.Open);
         var json = File.ReadAllText(acc_file);
         accountList = JsonConvert.DeserializeObject <AccountList>(json);
         CreateTable();
         //foreach (var acc in accountList.accounts)
         //{
         //    listBox1.Items.Add(acc.Login);
         //}
     }
     else
     {
         MessageBox.Show("Добавте аккаунты через форму добаления");
     }
 }