Çalışan Programları İzleme

** Bir çalışan programı nasıl izlenir**

Aşağıdaki örnek kod, bir çalışan programın nasıl izleneceğini göstermektedir. Bu kod, Workbook ile ilgili kodların çalışmasını izlemek için kullanılabilir. Basitçe SystemTimeInterruptMonitor sınıfını kullanarak bir izleme nesnesi oluşturun, LoadOptions çalışan parametrelerine eklemek için SetInterruptMonitor fonksiyonunu kullanın ve ardından beklenen kesinti süresini (milisaniye cinsinden) ayarlamak için StartMonitor fonksiyonunu kullanın. İzlenen kodun çalışma süresi beklenen süreyi aşarsa, program kesilecek ve bir istisna fırlatılacaktır.

Örnek Kod

SystemTimeInterruptMonitor monitor = new SystemTimeInterruptMonitor(false);
LoadOptions lopts = new LoadOptions();
lopts.InterruptMonitor = monitor;
monitor.StartMonitor(1000); //time limit is 1 second
Workbook wb = new Workbook("Large.xlsx", lopts);
//if the time cost of loading the template file exceeds one second, interruption will be required and exception will be thrown here
//otherwise starts to monitor the save procedure
monitor.StartMonitor(1500); //time limit is 1.5 seconds
wb.Save("result.xlsx");