private void btnAccDel_Click(object sender, EventArgs e) //Кнопка Удалить Аккаунт { var tempAccName = (string)lbAccList.SelectedItem; _fm.clbStartAccList.Items.Remove(tempAccName); lbAccList.Items.Remove(tempAccName); Sepo.DeleteAcc(tempAccName); btnAccDel.Enabled = false; if (lbAccList.SelectedItems.Count > 0) { lbAccList.ClearSelected(); } SetTextToDefault(); btnAccManDelAll.Enabled = lbAccList.Items.Count > 1; }
private void btnAccMod_Click(object sender, EventArgs e) //Кнопка Изменить аккаунт { var tempAccName = (string)lbAccList.SelectedItem; Sepo.ReadAccData(tempAccName); var tempAccData = new List <string>() { Sepo.RAccName, Sepo.RAccLogin, Sepo.RAccPass }; if ((string)lbAccList.SelectedItem != tbAccName.Text) { Sepo.CreateAccData(tbAccName.Text, tbAccLogin.Text, tbAccPass.Text); Sepo.DeleteAcc(tempAccName); _fm.clbStartAccList.Items.Add(tbAccName.Text); _fm.clbStartAccList.Items.Remove(tempAccName); lbAccList.Items.Add(tbAccName.Text); lbAccList.Items.Remove(tempAccName); } else { if (tempAccData[1] != tbAccLogin.Text) { Sepo.ModifyRegAccData(tempAccName, "AccLogin", tbAccLogin.Text); } if (tempAccData[2] != tbAccPass.Text) { Sepo.ModifyRegAccData(tempAccName, "AccPass", tbAccPass.Text); } } SetTextToDefault(); lbAccList.ClearSelected(); lbAccList.Enabled = true; btnAccMod.Enabled = false; }