Ejemplo n.º 1
0
        private void SetValueForExamWorkSheet(byte[] value, IExamInfo examInfo)
        {
            CpuClock c = new CpuClock();

            try
            {
                using (_workSheetsOnExam.LockOnCollectionChanged())
                {
                    using (_fetalBPSInfoNodes.LockOnCollectionChanged())
                    {
                        _fetalBPSInfoNodes.Clear();
                        _workSheetsOnExam.Clear();
                        try
                        {
                            if (value != null && value.Length > 0)
                            {
                                ScanNodeContext context = new ScanNodeContext((ExamInfo)examInfo);

                                var extensibleData = ExtensibleData.DeSerialize(value, context);
                                if (extensibleData != null)
                                {
                                    _fetalBPSInfoNodes.AddRange(extensibleData.BpsNodes);
                                    _workSheetsOnExam.AddRange(extensibleData.ScanNodes);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            _workSheetsOnExam.Clear();
                            _fetalBPSInfoNodes.Clear();
                            Logger.WriteLineError("Failed to parse ExtensibleData value, details:{0}.", ex);
                        }
                    }
                }
            }
            finally
            {
                if (c.TotalMilliSeconds >= 500)
                {
                    Logger.WriteLineError("ExamInfo.SetWorkSheetsXml spent {0:F2} ms", c.TotalMilliSeconds);
                }
            }
        }