private void CopyReqTraceFrom() { List <string> lString; string[] arrString; reqTraceNode.GetTraceFromString(out lString); arrString = lString.ToArray(); CopyText(string.Join("\n", arrString)); }
public void AddRow(ReqTraceNode reqTraceNode) { DataGridViewListBoxCell lbCell; DataGridViewRow row; string[] astrReq; string strTraceTo = ""; string strTraceFrom = ""; List <string> arrTracesTo; List <string> arrTracesFrom; reqTraceNode.GetTraceToString(out arrTracesTo); foreach (string str in arrTracesTo) { strTraceTo += str + "\r\n"; } reqTraceNode.GetTraceFromString(out arrTracesFrom); foreach (string str in arrTracesFrom) { strTraceFrom += str + "\r\n"; } astrReq = new string[] { reqTraceNode.Tag, reqTraceNode.TagName, reqTraceNode.Text, }; row = new DataGridViewRow(); row.CreateCells(this, astrReq); if (reqTraceNode.IsRootNode) { row.Cells[1].Style.BackColor = Color.FromArgb(200, 255, 200); } row.Height = Font.Height * 11 / 2; row.ContextMenuStrip = mnuCtxRow; row.HeaderCell.ContextMenuStrip = mnuCtxRow; row.Tag = reqTraceNode.Key; Rows.Add(row); lbCell = (DataGridViewListBoxCell)row.Cells[3]; foreach (string str in arrTracesTo) { lbCell.Items.Add(str); } lbCell = (DataGridViewListBoxCell)row.Cells[4]; foreach (string str in arrTracesFrom) { lbCell.Items.Add(str); } }
private void ShowRequirements(ArrayList arrKeys, string strTreePathName, bool bWithFilter) { ReqProRequirementPrx rpxReq; FormGenericTable genTable; int nCount; string strCell; int nTraceCountTo; int nTraceCountFrom; ReqProRequirementPrx[] arpxReqTracesTo; ReqProRequirementPrx[] arpxReqTracesFrom; ReqTraceNode reqTN; string[] arrStringTrace; List <string> listTrace = new List <string>(); string[,] astrGrid; List <string[]> aastrCells; List <string> rowHdrCells = new List <string>(); string[] rowCells; string[] astrCol; string[] astrValue; int nColCount; List <string> colTraceTo; List <string> colTraceFrom; ReqProRequirementPrx.eTraceAbortReason eAbortReason = ReqProRequirementPrx.eTraceAbortReason.eNoAbort; if (bWithFilter) { if (!ToContinueAfterFilter(true, false)) { return; } } genTable = new FormGenericTable("Requirements - Package: " + strTreePathName, null, null, FormGenericTableLayout.eFormGenericTableToken.eReqDetails); nCount = 0; /* at least we have: Tag, Name, Text, Version, Date, User, */ rowHdrCells.Add("Tag"); rowHdrCells.Add("Name"); rowHdrCells.Add("Text"); rowHdrCells.Add("Version"); rowHdrCells.Add("Date"); rowHdrCells.Add("User"); rowHdrCells.Add("Path"); rowHdrCells.Add("Package"); colTraceTo = new List <string>(); colTraceFrom = new List <string>(); colTraceTo.Add("Trace To"); colTraceFrom.Add("Trace From"); aastrCells = new List <string[]> (); foreach (int nKey in arrKeys) { int nColIdx; rowCells = new string [rowHdrCells.Count]; rpxReq = reqDBBrowser.GetRequirementPrx(nKey); if (!listnReqTypeRootKeyExcl.Contains(rpxReq.ReqTypeKey)) { rowCells[0] = rpxReq.Tag; rowCells[1] = rpxReq.Name; rowCells[2] = rpxReq.Text; rowCells[3] = rpxReq.VersionNumber; rowCells[4] = rpxReq.VersionDateTime; rowCells[5] = rpxReq.VersionUser; rowCells[6] = rpxReq.PackagePathName; rowCells[7] = rpxReq.PackageName; nColCount = rpxReq.GetAttributes(out astrCol, out astrValue); for (int i = 0; i < nColCount; i++) { nColIdx = rowHdrCells.IndexOf(astrCol[i]); if (nColIdx == -1) { int nOldCnt = rowHdrCells.Count; string[] rowCellsOld = rowCells; rowCells = new string[nOldCnt + 1]; rowHdrCells.Add(astrCol[i]); for (int j = 0; j < nOldCnt; j++) { rowCells[j] = rowCellsOld[j]; } nColIdx = rowHdrCells.Count - 1; } rowCells[nColIdx] = astrValue[i]; if (rowCells[nColIdx] == null) { rowCells[nColIdx] = ""; } System.Diagnostics.Trace.Write(rowHdrCells[nColIdx] + "(" + rowCells[nColIdx] + "); "); } aastrCells.Add(rowCells); arpxReqTracesTo = rpxReq.GetRequirementTracesTo(20, ref eAbortReason, out nTraceCountTo, null); arpxReqTracesFrom = rpxReq.GetRequirementTracesFrom(20, ref eAbortReason, out nTraceCountFrom, null); reqTN = new ReqTraceNode(rpxReq, 0, true, arpxReqTracesFrom, arpxReqTracesTo, nTraceCountFrom, nTraceCountTo, eAbortReason, 0, 0); reqTN.GetTraceFromString(out listTrace); arrStringTrace = listTrace.ToArray(); colTraceFrom.Add(string.Join("\n", arrStringTrace)); reqTN.GetTraceToString(out listTrace); arrStringTrace = listTrace.ToArray(); colTraceTo.Add(string.Join("\n", arrStringTrace)); nCount++; } } aastrCells.Insert(0, rowHdrCells.ToArray()); // we want some additional space for Trace To and From astrGrid = new string[aastrCells.Count, rowHdrCells.Count + 2]; for (int i = 0; i < aastrCells.Count; i++) { int j; for (j = 0; j < rowHdrCells.Count; j++) { if (j < aastrCells[i].GetLength(0)) { strCell = aastrCells[i][j]; } else { strCell = null; } if (strCell == null) { strCell = "n/a"; } astrGrid[i, j] = strCell; } astrGrid[i, j] = colTraceTo[i]; astrGrid[i, j + 1] = colTraceFrom[i]; } genTable.SetGridContent(astrGrid, nCount + " Requirements"); genTable.Show(); }