protected void updateAgent(object sender, EventArgs e) { string agentInfo = HandleAgent.Text; for (int i = 0; i < agentList.Count; i++) { Agent theAgent = (Agent)agentList[i]; string tempAgentInfo = "Agent " + theAgent.CodeName + ", ID: " + theAgent.getId(); if (agentInfo == tempAgentInfo) { theAgent.setLanguages(EditLang1.Text, EditLang2.Text); theAgent.setName(EditName.Text); if (EditCeasarText.Text != "" && EditCeasarKey.Text != "") { theAgent.CodeName = CeasarEncryption.Encrypt(EditCeasarText.Text, Int32.Parse(EditCeasarKey.Text)); } agentList[i] = theAgent; EditName.Text = "Real name"; EditLang1.Text = "Native Lang"; EditLang2.Text = "Other Lang"; EditCeasarText.Text = ""; EditCeasarKey.Text = ""; HandleAgent.Text = "Choose an Agent"; this.listboxagentUpdate(); } } }
public Agent(string name, string[] languages) { this.id = agentCounter; this.name = name; this.languages.Add(""); this.languages.Add(""); this.CodeName = CeasarEncryption.Encrypt(name, 12); this.setLanguages(languages[0], languages[1]); agentCounter++; }
// property for name public void setName(string Name) { this.name = Name; this.CodeName = CeasarEncryption.Encrypt(Name, 12); }