public void Open(Int64 recNo) { db.Lock(); try { this.recNo = recNo; bufferedSeries.ClearPoints(); double totalTime = 0; DataBookDataSet bookSet = db.DataBookSet; DataRawUnitDataSet rawUnitSet = db.DataRawUnitSet; DataRawDataSet rawSet = db.DataRawSet; UnitConvert unit = new UnitConvert(EUnitType.None, 0, 0); bookSet.Select(recNo); if (bookSet.IsEmpty() == false) { bookSet.Fetch(); scanTime = bookSet.ScanTime; bufferedSeries.BaseTime = scanTime * 1000; if (string.IsNullOrWhiteSpace(bookSet.TestName) == true) { fName = $"None_Line{bookSet.TestLine + 1}"; } else { fName = $"{bookSet.TestName}_Line{bookSet.TestLine + 1}"; } rawUnitSet.Select(bookSet.RecNo); try { for (int i = 0; i < rawUnitSet.GetRowCount(); i++) { rawUnitSet.Fetch(i); unit.Type = (EUnitType)rawUnitSet.UnitType; unit.From = rawUnitSet.UnitFrom; unit.To = rawUnitSet.UnitTo; SetMethodUnit((EUnitType)rawUnitSet.UnitType, rawUnitSet.UnitTo); SetPlotSeriesUnit(i, (EUnitType)rawUnitSet.UnitType, rawUnitSet.UnitTo); rawSet.Select(rawUnitSet.RecNo); for (int j = 0; j < rawSet.GetRowCount(); j++) { rawSet.Fetch(j); if (rawSet.DataRaw == null) { break; } if (i == 0) { totalTime += (rawSet.DataRaw.Length - 1) * bufferedSeries.BaseTime; } ConvertUnit(unit, rawSet.DataRaw); bufferedSeries[i].Points.AddRange(rawSet.DataRaw); } Win32.SwitchToThread(); } } finally { foreach (TabPage page in graphTab.TabPages) { CtrlViewGraphPanel ctrl = page.Controls[0] as CtrlViewGraphPanel; ctrl.Method = method; ctrl.RefreshYAxesUnit(); ctrl.SetMaxRangeAxisX(totalTime); } InvalidateGraphSeries(graphTab.SelectedTab); } } } finally { db.Unlock(); } }
public void Open(Int64 recNo) { sheetTags.Clear(); db.Lock(); try { Dictionary <string, Cell> sheet; DataBookDataSet bookSet = db.DataBookSet; DataSheetDataSet sheetSet = db.DataSheetSet; DataValueUnitDataSet valueUnitSet = db.DataValueUnitSet; DataValueDataSet valueSet = db.DataValueSet; bookSet.Select(recNo); if (bookSet.IsEmpty() == false) { bookSet.Fetch(); if (string.IsNullOrWhiteSpace(bookSet.TestName) == true) { fName = $"None_Line{bookSet.TestLine + 1}"; } else { fName = $"{bookSet.TestName}_Line{bookSet.TestLine + 1}"; } sheetSet.Select(bookSet.RecNo); for (int i = 0; i < sheetSet.GetRowCount(); i++) { sheetSet.Fetch(i); bool isNozzle = false; if ((sheetSet.IDState.EndsWith("Cooling") == true) || (sheetSet.IDState.EndsWith("Heating") == true)) { isNozzle = true; } sheet = sheetTags.Sheets[sheetSet.SheetName]; reportSheet.BeginUpdate(); try { SetSheetTitle(sheet, bookSet, sheetSet); if (sheetSet.Use == true) { valueUnitSet.Select(sheetSet.RecNo); if (i < 4) { SetSheetValues(sheet, calorieTags, bookSet.IntegCount, bookSet.IntegTime, valueUnitSet, valueSet, false, isNozzle); } else { SetSheetValues(sheet, thermoTags, bookSet.IntegCount, bookSet.IntegTime, valueUnitSet, valueSet, true, false); } } } finally { reportSheet.EndUpdate(); } Thread.Sleep(1); } } } finally { db.Unlock(); } }