Ejemplo n.º 1
0
        private void AddBt_Click(object sender, EventArgs e)
        {
            if (listViewAccounts.SelectedItems.Count > 0)
            {
                List<AccountUC> listaccounts = new List<AccountUC>();
                foreach (ListViewItem account in listViewAccounts.SelectedItems)
                {

                    listaccounts.Add(new AccountUC(account.SubItems[0].Text, account.SubItems[1].Text, false));
                }
                if (NameBox.Text.Length > 0)
                {
                    AccountsFileInteractions accountsFileInteractions = new AccountsFileInteractions();
                    accountsFileInteractions.SaveGroup(listaccounts, NameBox.Text + ".bs");
                    listViewGroups.Items.Add(NameBox.Text);
                    groups.Add(new Group(listaccounts, NameBox.Text));
                    listViewAccounts.SelectedItems.Clear();
                    NameBox.Clear();
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Merci de rajouter un nom pour le groupe. Merci pour eux. :3");
                }
            }
        }
Ejemplo n.º 2
0
 private void buttonAddAccount_Click(object sender, EventArgs e)
 {
     if ((textBoxAccountName.Text == string.Empty) || (textBoxAccountName.Text == "Entrez le nom de compte..."))
         MessageBox.Show("Merci d'entrer un nom de compte.", "BS Error");
     else if ((textBoxPassword.Text == string.Empty) || (textBoxPassword.Text == "Entrez le mot de passe..."))
         MessageBox.Show("Merci d'entrer un mot de passe.", "BS Error");
     else
     {
         foreach (ListViewItem bot in listViewAccounts.Items)
         {
             if (bot.Text == textBoxAccountName.Text)
             {
                 MessageBox.Show("Ce compte a déjà été ajouté.", "BS Error");
                 textBoxAccountName.Text = string.Empty;
                 textBoxPassword.Text = string.Empty;
                 return;
             }
         }
         string[] row1 = { textBoxAccountName.Text, textBoxPassword.Text };
         ListViewItem li = new ListViewItem(row1);
         listViewAccounts.Items.Add(li);
         AccountsFileInteractions accountsFileInteractions = new AccountsFileInteractions();
         List<Bot> listaccount = new List<Bot>();
         foreach (ListViewItem item in listViewAccounts.Items)
         {
             listaccount.Add(new Bot(new Account(item.SubItems[0].Text, item.SubItems[1].Text)));
         }
         accountsFileInteractions.SaveAccountsInfos(listaccount);
         textBoxAccountName.Text = string.Empty;
         textBoxPassword.Text = string.Empty;
         listViewAccounts.Items[0].Focused = true;
         listViewAccounts.Items[0].Selected = true;
     }
 }
Ejemplo n.º 3
0
 private void LoadAccounts()
 {
     AccountsFileInteractions accountsFileInteractions = new AccountsFileInteractions();
     accountsFileInteractions.RecoverAccountsInfos();
     foreach (Account accountObject in accountsFileInteractions.Accounts)
     {
         string[] row1 = { accountObject.Name, accountObject.Password };
         ListViewItem li = new ListViewItem(row1);
         listViewAccounts.Items.Add(li);
     }
 }
Ejemplo n.º 4
0
 private void DelBt_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < listViewAccounts.SelectedItems.Count; i++)
     //parcours des comptes sélectionnés
     {
         ListViewItem listViewItem2 = listViewAccounts.SelectedItems[i];
         // Sauvegarde des comptes
         AccountsFileInteractions accountsFileInteractions = new AccountsFileInteractions();
         List<Bot> listaccount = new List<Bot>();
         foreach (ListViewItem item in listViewAccounts.Items)
         {
             listaccount.Add(new Bot(new Account(item.SubItems[0].Text, item.SubItems[1].Text)));
         }
         accountsFileInteractions.SaveAccountsInfos(listaccount);
         // suppression de l'interface
         listViewAccounts.Items.Remove(listViewItem2);
     }
 }
Ejemplo n.º 5
0
        private void LoadGroups()
        {
            //if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\groups.bs"))
            //{
            //    StreamReader reader = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\groups.bs");
            //    while (reader.Peek() > 0)
            //    {
            //        string line = reader.ReadLine();
            //    }

                AccountsFileInteractions accountsFileInteractions = new AccountsFileInteractions();

                accountsFileInteractions.RecoverGroups();

                foreach (Group Groupobject in accountsFileInteractions.Groups)
                {
                    string[] row1 = { Groupobject.name };
                    ListViewItem li = new ListViewItem(row1);
                    listViewGroups.Items.Add(li);
                    groups.Add(Groupobject);
                }
            //}
        }
Ejemplo n.º 6
0
        private void LoadGroups()
        {
            AccountsFileInteractions accountsFileInteractions = new AccountsFileInteractions();

            accountsFileInteractions.RecoverGroups();

            foreach (Group Groupobject in accountsFileInteractions.Groups)
            {
                string[] row1 = { Groupobject.name };
                ListViewItem li = new ListViewItem(row1);
                listViewGroups.Items.Add(li);
                groups.Add(Groupobject);
            }
        }