private void RenderThread() { Label_0000: if (((this.m_RenderingNoticeCount <= 0) && (this.m_RenderingNoticeQueue.Count == 0)) && this.m_RenderingNoticeQueue.IsClosed) { logger.Info("Очередь рендера закрыта"); this.m_SaveRenderedNoticeQueue.IsClosed = true; } else { if ((this.m_RenderingNoticeQueue.Count == 0) || this.m_RenderingNoticeQueue.IsWaiting) { System.Threading.Thread.Sleep(10); } this.CheckNoticeRenderer(); if (!this.m_IsRendererSuspended) { RenderingNotice notice = null; if (this.m_RenderingNoticeQueue.TryDequeue(out notice)) { logger.Info("Рендер " + ((long) notice.Notice.Id)); System.Threading.Interlocked.Increment(ref this.m_RenderingNoticeCount); byte[] buffer = null; bool hasResult = false; int pageCount = 0; if (notice.HeaderTable.Rows.get_Count() > 0) { int num2 = 1; bool flag2 = false; while (num2 <= 5) { try { buffer = m_IsolatedNoticeRenderer.Object.RenderNotice(0, (System.Data.DataTable) notice.HeaderTable, (System.Data.DataSet) notice.ReportSet, notice.TemplateContent, out pageCount, out hasResult); bool preserveStiReport = this.m_PreserveStiReport; System.Threading.Interlocked.Increment(ref this.m_TotalRendered); break; } catch (System.Exception exception) { logger.Warn("Попытка рендера № {0} извещения {1}{2}{3}", new object[] { (int) num2, (long) notice.Notice.Id, System.Environment.get_NewLine(), exception.ToString() }); num2 = (int) (num2 + 1); if (num2 > 5) { logger.Error(string.Concat((object[]) new object[] { "Неудачно завершился рендер ", ((long) notice.Notice.Id), System.Environment.get_NewLine(), exception.ToString() })); System.Threading.Interlocked.Decrement(ref this.m_RenderingNoticeCount); flag2 = true; } System.Threading.Thread.Sleep(0x3e8); continue; } } if (flag2) { goto Label_0000; } } notice.Dispose(); NoticeRenderedNotice item = new NoticeRenderedNotice { Period = notice.Notice.Period, PacketReport = buffer, AccountId = notice.Notice.AccountId, HouseHolderId = notice.Notice.HouseHolderId, Barcode = notice.Notice.Barcode, HasResult = hasResult, NoticeTemplateId = notice.TemplateId, PageCount = pageCount }; this.m_SaveRenderedNoticeQueue.Enqueue(item); System.Threading.Interlocked.Increment(ref this.m_ProcessedNoticeCount); System.Threading.Interlocked.Decrement(ref this.m_RenderingNoticeCount); } } goto Label_0000; } }
public NoticeReport(NoticeRenderedNotice renderedNotice) { this.RenderedNotices = new System.Collections.Generic.List<NoticeRenderedNotice>(); this.RenderedNotices.Add(renderedNotice); }