private void AddRowToDataGridView(OpcTag opcTag) { int newRowIndex = dgvOpcData.Rows.Add(); dgvOpcData.Rows[newRowIndex].Cells[0].Value = opcTag.Path; dgvOpcData.Rows[newRowIndex].Cells[1].Value = opcTag.Value; dgvOpcData.Rows[newRowIndex].Cells[2].Value = opcTag.Quality.ToString(); dgvOpcData.Rows[newRowIndex].Cells[3].Value = ((int)opcTag.Quality).ToString(); }
private void CheckExpectedTagFromProtocol(ProtocolLine protocolLine) { List <OpcTag> opcTagList = opcReader.ReadAllTags(); OpcTag.OpcTagQuality qualityFromInt = (OpcTag.OpcTagQuality)Convert.ToInt32(protocolLine.TagQualityInt); OpcTag tagToCheck = new OpcTag(protocolLine.TagPath, protocolLine.TagValue, qualityFromInt); if (opcTagList.Contains(tagToCheck)) { FillOpcDataGrid(opcTagList); IncrementCurrentProtocolLine(); } }
public void WriteSingleTag(OpcTag opcTag) { try { WaitForAndAcquireFileLock(); //bool tagUpdated = false; string opcTagLine = opcTag.Path + ';' + opcTag.Value + ';' + opcTag.Quality.ToString() + ';' + ((int)opcTag.Quality).ToString(); List <string> opcTagFileContent = File.ReadAllLines(DataFilePath).ToList(); int tagPostionInFile = FileContentContainsTag(opcTagFileContent, opcTag.Path); if (IsFileEmpty(opcTagFileContent) || TagNotInFile(tagPostionInFile)) { opcTagFileContent.Add(opcTagLine); } else { opcTagFileContent[tagPostionInFile] = opcTagLine; } File.WriteAllText(DataFilePath, string.Join(Environment.NewLine, opcTagFileContent.ToArray())); } catch (LockFileAcquisitionException exLock) { logger.Error("Locking of data file failed", exLock); throw; } finally { ReleaseFileLock(); } }