本文整理汇总了C#中ProgressCallback.OnProgressUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressCallback.OnProgressUpdate方法的具体用法?C# ProgressCallback.OnProgressUpdate怎么用?C# ProgressCallback.OnProgressUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressCallback
的用法示例。
在下文中一共展示了ProgressCallback.OnProgressUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInterimPdfs
internal Dictionary<string, PageSelection> CreateInterimPdfs(List<WorkbookItem> workbookItems, ProgressCallback progress)
{
Dictionary<string, PageSelection> interimPdfFiles = new Dictionary<string, PageSelection>();
// Need to ensure the DocumentPublisher is disposed after the Pdfs are created otherwise
// application instances are left in memory until the Combine exe closes. This can cause
// issues with using Word automation while Combine exe is still open (see DE7973).
using (DocumentPublisher documentPublisher = DocumentPublisher.Instance())
{
foreach (WorkbookItem wfm in workbookItems)
{
if (progress != null)
{
progress.OnProgressUpdate(wfm, CombineStage.BeforeConvert, true);
}
try
{
if (string.IsNullOrEmpty(wfm.Pdf))
{
var encryptionManager = new Workshare.Policy.ContentEncryption.ContentEncryptionManager();
var decryptedFilePath=string.Empty;
var encryptResult = encryptionManager.DecryptFile(wfm.FileName, wfm.DocumentId,encryptionUI, out decryptedFilePath);
switch (encryptResult)
{
case Policy.ContentEncryption.Interfaces.DecryptResult.Ok:
{
wfm.TempCopy = decryptedFilePath;
CleanDocumentIfRequired(wfm);
if (wfm.PageSelection == null)
{
wfm.Pdf = documentPublisher.Print(wfm);
}
else
{
wfm.Pdf = documentPublisher.PrintRange(wfm, wfm.PageSelection);
}
break;
}
case Policy.ContentEncryption.Interfaces.DecryptResult.Cancel: return new Dictionary<string, PageSelection>();
case Policy.ContentEncryption.Interfaces.DecryptResult.Skip: continue;
}
}
else
{
if (Workshare.Pdf.Security.HasOpenPassword(wfm.Pdf) &&
!Utilities.RemovePassword(wfm))
{
continue;
}
if (wfm.PageSelection != null)
{
Workshare.Pdf.Edit.DeletePages(wfm.Pdf, Utilities.GetPageNumbersToDelete(wfm));
}
}
// Powerpoint or Excel documents with no content generate zero byte Pdfs
// which then cause exceptions in the TronReader. Pick up zero byte pdfs
// here and do not include them.
FileInfo infoPDF = new FileInfo(wfm.Pdf);
if (!infoPDF.Exists || infoPDF.Length <= 0)
{
if (progress != null)
{
progress.OnProgressUpdate(wfm, CombineStage.AfterConvert, false);
}
string message = wfm.DisplayName + " is an empty document.\n\nDo you wish to continue?";
if (WsMessage.ShowMessage(IntPtr.Zero, message, MessageButtons.WsYesNo, MessageBranding.WsDefault) == MessageResult.WsResultNo)
{
return GetEmptyResult();
}
continue;
}
interimPdfFiles.Add(wfm.Pdf, wfm.PageSelection);
}
catch (Exception ex)
{
if (progress != null)
{
progress.OnProgressUpdate(wfm, CombineStage.AfterConvert, false);
}
// Use the filename part of DocumentId, but if empty then use DisplayName.
// Reason: Depending on the file format and method of loading, the DisplayName may *not*
// include the file extension. (...or even match the file name at all!)
string sFilename;
if (string.IsNullOrEmpty(wfm.DocumentId))
{
sFilename = wfm.DisplayName;
}
else
{
sFilename = System.IO.Path.GetFileName(wfm.DocumentId);
}
//.........这里部分代码省略.........