private void LoadFileData(string path) { try { var extension = System.IO.Path.GetExtension(path); var reader = ReaderTypesManager.GetReader(extension); if (reader != null) { List <ITradeData> tradeDataList = new List <ITradeData>(); using (TextReader textReader = new StreamReader(path)) { var tradeData = reader.ReadTradeData(textReader); if (tradeData != null) { tradeDataList.AddRange(tradeData); } } RunOnUiThread(() => ShowLoadFileDataResult(path, tradeDataList)); DataDirectoryMonitor.MarkFileNameAsProcessed(path); } } catch (Exception e) { var msg = e.Data.Contains("rowNo") ? "RowNumber=" + e.Data["rowNo"] + ": " + e.Message : e.Message; RunOnUiThread(() => ShowLoadFileDataResult(path, null, msg)); Trace.TraceError("Exception occured when processing the file: " + path + Environment.NewLine + msg); Trace.Flush(); DataDirectoryMonitor.MarkFileNameAsInvalid(path); } }