当前位置: 首页>>代码示例>>C#>>正文


C# AsyncOperation.get_UserSuppliedState方法代码示例

本文整理汇总了C#中System.ComponentModel.AsyncOperation.get_UserSuppliedState方法的典型用法代码示例。如果您正苦于以下问题:C# AsyncOperation.get_UserSuppliedState方法的具体用法?C# AsyncOperation.get_UserSuppliedState怎么用?C# AsyncOperation.get_UserSuppliedState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.AsyncOperation的用法示例。


在下文中一共展示了AsyncOperation.get_UserSuppliedState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AbortOperation

 protected void AbortOperation(AsyncOperation asyncOp, System.Exception ex, System.TimeSpan timeSpent)
 {
     logger.ErrorException("Асинхронная операция завершилась неудачно", ex);
     if (this.m_RenderThreads != null)
     {
         System.Threading.Thread[] renderThreads = this.m_RenderThreads;
         for (int i = 0; i < renderThreads.Length; i = (int) (i + 1))
         {
             System.Threading.Thread thread = renderThreads[i];
             try
             {
                 thread.Abort();
                 logger.ErrorException("Поток рендера принудительно приостановлен", ex);
             }
             catch (System.Threading.ThreadAbortException)
             {
             }
         }
     }
     if (this.m_ReportGenerationThreads != null)
     {
         System.Threading.Thread[] reportGenerationThreads = this.m_ReportGenerationThreads;
         for (int j = 0; j < reportGenerationThreads.Length; j = (int) (j + 1))
         {
             System.Threading.Thread thread2 = reportGenerationThreads[j];
             try
             {
                 thread2.Abort();
                 logger.ErrorException("Поток экспорта принудительно приостановлен", ex);
             }
             catch (System.Threading.ThreadAbortException)
             {
             }
         }
     }
     if (asyncOp != null)
     {
         GenerationCompletedEventArgs args = new GenerationCompletedEventArgs(timeSpent, ex, this.m_IsCancelled, asyncOp.get_UserSuppliedState());
         asyncOp.PostOperationCompleted(this.onCompletedDelegate, args);
     }
     this.Reset();
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:42,代码来源:NoticeReportGenerator.cs

示例2: Generate


//.........这里部分代码省略.........
             report2.Dispose();
         }
         report = new NoticeReport(renderedNotices);
         this.m_GeneratedReport = report;
     }
     if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
     {
         ex = null;
         this.m_ThreadExceptions.TryDequeue(out ex);
         this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
     }
     else
     {
         if ((this.m_NoticeCache.get_Count() > 0) && (this.m_Exporter != null))
         {
             logger.Info("Экспорт по домам управляющих компаний");
             int num9 = (int) ((this.m_Exporter.MaxPageCount * this.m_Template.AccountsInTemplate) / this.m_Template.PageCount);
             CachedNoticeInfoComparer comparer = new CachedNoticeInfoComparer();
             try
             {
                 foreach (string str in this.m_NoticeCache.Keys)
                 {
                     this.m_NoticeCache[str].Sort(comparer);
                     logger.Info("Экспорт домов УК " + str);
                     for (int n = 0; n < this.m_NoticeCache[str].get_Count(); n = (int) (n + num9))
                     {
                         System.Text.StringBuilder builder = new System.Text.StringBuilder();
                         int num11 = this.m_NoticeCache[str].get_Count();
                         if (num11 != 0)
                         {
                             int maxPageCount = this.m_Exporter.MaxPageCount;
                             int num13 = (int) (num11 - (n + maxPageCount));
                             num13 = (num13 < 1) ? ((int) 0) : num13;
                             using (StiReport report3 = new StiReport())
                             {
                                 report3.IsRendered = true;
                                 report3.NeedsCompiling = false;
                                 report3.RenderedPages.Clear();
                                 System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(this.m_Exporter.DestinationPath, str));
                                 if (!info.get_Exists())
                                 {
                                     info.Create();
                                 }
                                 string file = System.IO.Path.Combine(info.get_FullName(), string.Format("{0}_{1}.pdf", str, n / num9));
                                 for (int num14 = n; num14 < (num11 - num13); num14 = (int) (num14 + 1))
                                 {
                                     System.IO.FileInfo info2 = new System.IO.FileInfo(this.m_NoticeCache[str].get_Item(num14).CacheFilePath);
                                     if (info2.get_Exists())
                                     {
                                         byte[] bytes = System.IO.File.ReadAllBytes(info2.get_FullName());
                                         StiReport report4 = new StiReport();
                                         report4.LoadPackedDocument(bytes);
                                         report4.ReportUnit = report3.ReportUnit;
                                         foreach (StiPage page in report4.RenderedPages)
                                         {
                                             page.Report = report3;
                                             page.Guid = System.Guid.NewGuid().ToString().Replace("-", "");
                                             report3.RenderedPages.Add(page);
                                         }
                                         if (this.m_Exporter.DualPageExportMode && ((report4.RenderedPages.get_Count() % 2) != 0))
                                         {
                                             StiPage page2 = new StiPage(report3) {
                                                 IsRendered = true,
                                                 Orientation = report4.RenderedPages[0].Orientation,
                                                 Guid = System.Guid.NewGuid().ToString().Replace("-", "")
                                             };
                                             report3.RenderedPages.Add(page2);
                                         }
                                         builder.AppendLine(this.m_NoticeCache[str].get_Item(num14).FullAddress);
                                     }
                                 }
                                 report3.ExportDocument(StiExportFormat.Pdf, file);
                                 System.IO.File.WriteAllText(file + ".txt", builder.ToString());
                             }
                         }
                     }
                 }
                 logger.Info("Очистка дискового кэша");
                 System.IO.Directory.Delete(System.IO.Path.Combine(this.m_Exporter.DestinationPath, this.m_ExportCacheDirectoryName), true);
             }
             catch (System.Exception exception19)
             {
                 ex = new NoticeGenerationException("Ошибка при экспорте извещений, сгруппированных по УК", exception19);
                 this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
                 return;
             }
         }
         System.TimeSpan timeSpent = (System.TimeSpan) (System.DateTime.Now - now);
         logger.Info("Операция успешно завершена. Время выполнения " + timeSpent.ToString());
         logger.Info("Всего отрендерено: " + ((int) this.m_TotalRendered));
         if (asyncOp != null)
         {
             GenerationCompletedEventArgs args = new GenerationCompletedEventArgs(timeSpent, null, false, asyncOp.get_UserSuppliedState()) {
                 GeneratedReport = report
             };
             asyncOp.PostOperationCompleted(this.onCompletedDelegate, args);
         }
         this.Reset();
     }
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:101,代码来源:NoticeReportGenerator.cs

示例3: ReportPercentage

 private void ReportPercentage(AsyncOperation asyncOp)
 {
     if (((asyncOp != null) && (this.AccountListStatistics.AccountCount > 0L)) && (this.m_ProcessedNoticeCount > 0L))
     {
         asyncOp.Post(this.onProgressReportDelegate, new GenerationProgressChangedEventArgs(null, System.Convert.ToInt32((decimal) ((this.m_ProcessedNoticeCount / System.Convert.ToDecimal((long) (this.AccountListStatistics.AccountCount * this.Templates.get_Count()))) * 100M)), asyncOp.get_UserSuppliedState()));
     }
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:7,代码来源:NoticeReportGenerator.cs


注:本文中的System.ComponentModel.AsyncOperation.get_UserSuppliedState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。