当时间过长时使用 InterruptMonitor 停止转换或加载

可能的使用场景

Aspose.Diagram allows you to stop the conversion of Diagram to various formats like PDF, HTML etc. using the 中断监视器反对时间太长。转换过程通常是 CPU 和内存密集型的,当资源有限时停止它通常很有用。您可以使用中断监视器既用于停止转换也用于停止加载巨大的 diagram。请使用Diagram.InterruptMonitor停止转换的属性和LoadOptions.InterruptMonitor用于加载巨大 diagram 的属性。

当时间过长时使用 InterruptMonitor 停止转换或加载

下面的示例代码解释了中断监视器 object. The code converts quite a large Visio file to PDF. It will take several seconds (i.e. 超过 30 秒因为这些代码行而将其转换。

	      Aspose.Diagram.LoadOptions o = new Aspose.Diagram.LoadOptions(LoadFileFormat.VSDX);
	      o.InterruptMonitor = im;
	      Diagram diagram = new Diagram("Huge.vsdx", o);

正如你看到的巨大.vsdx是一个非常大的 VSDX 文件。但是,那**StopConversionOrLoadingUsingInterruptMonitor()**方法在 10 秒后中断转换,程序结束/终止。请使用以下代码来执行示例代码。

 new StopConversionOrLoadingUsingInterruptMonitor().TestRun();

示例代码