public string[] ReadCredentials() { string[] credentials; if (File.Exists(pathToFile)) { File.Decrypt(pathToFile); credentials = File.ReadAllLines(pathToFile); File.Encrypt(pathToFile); return(credentials); } else { credentials = MailVisualObjects.LoginDialog(); } return(credentials); }
public void RefreshMailBox() { lock (this) { idCounter = 0; try { List <Mail> temp = connection.GetMails(); foreach (Mail item in temp) { item.ID = idCounter++; } mailBox = temp; } catch { MessageBox.Show("Invalid credentials. Please try again."); string[] credentials = MailVisualObjects.LoginDialog(); connection.Credentials = credentials; } } }