本文整理汇总了C#中LocalReport.AddTrustedCodeModuleInCurrentAppDomain方法的典型用法代码示例。如果您正苦于以下问题:C# LocalReport.AddTrustedCodeModuleInCurrentAppDomain方法的具体用法?C# LocalReport.AddTrustedCodeModuleInCurrentAppDomain怎么用?C# LocalReport.AddTrustedCodeModuleInCurrentAppDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalReport
的用法示例。
在下文中一共展示了LocalReport.AddTrustedCodeModuleInCurrentAppDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrintLabelByTemplate
private static void PrintLabelByTemplate(LabelTemplate rdlTemplateName, IList<Label> listOfLabels)
{
try
{
if (listOfLabels == null || listOfLabels.Count == 0)
return;
sListLabels = listOfLabels;
try
{
//Si viene una impresora definida utiliza esa, si no utiliza la del template
if (rdlTemplateName != null)
curTemplate = rdlTemplateName;
else
curTemplate = (new DaoFactory()).DaoLabelTemplate().Select(new LabelTemplate { Header = WmsSetupValues.ProductLabelTemplate }).First();
usePrinter = (usePrinter == null)
? new Printer { PrinterName = curTemplate.DefPrinter.Name, PrinterPath = curTemplate.DefPrinter.CnnString }
: usePrinter;
}
catch { throw new Exception("Printer not defined for template " + curTemplate.Name); }
if (usePrinter == null)
throw new Exception("Printer not defined for template " + curTemplate.Name);
//Revisa si el label imprime por comandos y lo manda a esa ruta.
if (rdlTemplateName.IsPL == true)
{
PrintLabelByPL(rdlTemplateName, listOfLabels, usePrinter);
return;
}
string labelPath = Path.Combine(AppPath, WmsSetupValues.RdlTemplateDir + "\\" + rdlTemplateName.Header);
if (!File.Exists(labelPath))
throw new Exception("Label template " + labelPath + " does not exists.\n");
localReport = new LocalReport();
localReport.EnableExternalImages = true;
localReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence);
localReport.AddTrustedCodeModuleInCurrentAppDomain("Barcode, Version=1.0.5.40001, Culture=neutral, PublicKeyToken=6dc438ab78a525b3");
localReport.AddTrustedCodeModuleInCurrentAppDomain("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
localReport.EnableExternalImages = true;
localReport.ReportPath = labelPath;
DataSet ds = ProcessLabels(listOfLabels);
localReport.DataSources.Add(new ReportDataSource("Details", ds.Tables["Details"]));
//Proceso de Creacion de archivos
m_streams.Add(curTemplate, new List<Stream>());
m_currentPageIndex.Add(curTemplate, 0);
Export(localReport, curTemplate, "IMAGE"); //1 - Document, 2 - Label
m_currentPageIndex[curTemplate] = 0;
//Ejecutar la impresion global en un Hilo
Thread th = new Thread(new ParameterizedThreadStart(Print));
th.Start(curTemplate.DefPrinter.CnnString);
//Print(curTemplate.DefPrinter.CnnString);
}
catch (Exception ex)
{
ExceptionMngr.WriteEvent("PrintLabelByTemplate:" + rdlTemplateName.Name, ListValues.EventType.Error, ex, null, ListValues.ErrorCategory.Business);
throw new Exception(ex.Message);
}
}
示例2: PrintDocumentThread
private void PrintDocumentThread(Object document)
{
//Report File exists
string reportPath = Path.Combine(AppPath, WmsSetupValues.RdlTemplateDir + "\\" + curTemplate.Header);
if (!File.Exists(reportPath))
throw new Exception("Report file does not exists.");
try
{
//Rendering Report
localReport = new LocalReport();
localReport.EnableExternalImages = true;
localReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence);
localReport.AddTrustedCodeModuleInCurrentAppDomain("Barcode, Version=1.0.5.40001, Culture=neutral, PublicKeyToken=6dc438ab78a525b3");
localReport.AddTrustedCodeModuleInCurrentAppDomain("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
localReport.EnableExternalImages = true;
localReport.ReportPath = reportPath;
//Obteniendo la informacion del Reporte (DataSet)
ReportHeaderFormat rptHdr = GetReportInformation((Document)document, curTemplate.Header);
DataSet ds = GetReportDataset(rptHdr);
localReport.DataSources.Add(new ReportDataSource("Header", ds.Tables["ReportHeaderFormat"]));
localReport.DataSources.Add(new ReportDataSource("Details", ds.Tables["ReportDetailFormat"]));
}
catch { return; }
//Print Report
//Proceso de Creacion de archivos
m_streams.Add(curTemplate, new List<Stream>());
m_currentPageIndex.Add(curTemplate, 0);
Export(localReport, curTemplate, "IMAGE"); //1 - Document, 2 - Label
m_currentPageIndex[curTemplate] = 0;
//Ejecutar la impresion global en un Hilo
Thread th = new Thread(new ParameterizedThreadStart(Print));
th.Start(curTemplate.DefPrinter.CnnString);
//Print(curTemplate.DefPrinter.CnnString);
}
示例3: PrintDocumentThread
private static void PrintDocumentThread(Object document)
{
//Report File exists
string reportPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), WmsSetupValues.RdlTemplateDir + "\\" + curTemplate.Header);
if (!File.Exists(reportPath))
return;
//Rendering Report
localReport = new LocalReport();
localReport.EnableExternalImages = true;
localReport.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence);
localReport.AddTrustedCodeModuleInCurrentAppDomain("Barcode, Version=1.0.5.40001, Culture=neutral, PublicKeyToken=6dc438ab78a525b3");
localReport.AddTrustedCodeModuleInCurrentAppDomain("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
localReport.EnableExternalImages = true;
localReport.ReportPath = reportPath;
DataSet ds;
//Document
ds = ReportMngr.ProcessDocument(((Document)document).DocID, new WMSServiceClient(), curTemplate.Header);
if (ds == null)
return;
localReport.DataSources.Add(new ReportDataSource("Header", ds.Tables["ReportHeaderFormat"]));
localReport.DataSources.Add(new ReportDataSource("Details", ds.Tables["ReportDetailFormat"]));
//Print Report
//Proceso de Creacion de archivos
m_streams.Add(curTemplate, new List<Stream>());
m_currentPageIndex.Add(curTemplate, 0);
Export(localReport, curTemplate, "IMAGE"); //1 - Document, 2 - Label
m_currentPageIndex[curTemplate] = 0;
//Ejecutar la impresion global en un Hilo
//Thread th = new Thread(new ParameterizedThreadStart(Print));
//th.Start(printer.PrinterName);
Print(usePrinter.PrinterName);
}