private void OnAddedFile(object source, FileSystemEventArgs e) { EmailEx email = new EmailEx(e.FullPath); InfoModel.Model.AddInfo(email.Subject, DateTime.Parse(email.Date), email.System); }
private void DoScanFolder(object source, DoWorkEventArgs e) { DirectoryInfo dir = new DirectoryInfo(SystemModel.Model.GetDirPath()); FileInfo[] files = dir.GetFiles("*.msg"); EmailEx email = null; ProgressBar pb = (ProgressBar) e.Argument; SetControlPropertyThreadSafe(pb, "Maximum", files.Length); for (int i = 0; i < files.Length; i++) { email = new EmailEx(files[i].FullName); InfoModel.Model.AddInfo(email.Subject, DateTime.Parse(email.Date), email.System); SetControlPropertyThreadSafe(pb, "Value", i); } SetControlPropertyThreadSafe(pb, "Value", 0); }