0
我在C#中有下面的代碼片斷來打開一個PowerDesigner模型,我想關閉/退出PowerDesigner應用程序實例,但我不知道如何?應用程序(PdCommon.Application)如何在C#中關閉?
PdCommon.Application pdApplication = null;
try{
//Creating PD Application object...
pdApplication = new PdCommon.Application();
//Opening the relevant models of a dedicated directory
String[] files = System.IO.Directory.GetFiles(ldmSourceDirectory);
foreach (String curFile in files){
if(curFile.EndsWith(".cdm")){
pdApplication.OpenModel(@curFile, PdCommon.OpenModelFlags.omf_DontOpenView);
}
}
//Doing some operations...
}finally{
if (pdApplication != null){
//Closing models
foreach (PdCDM.Model curPDModel in pdApplication.Models){
curPDModel.Close(false);
}
//But how can I close the application?
pdApplication = null;
}
}
在您目前的情況下,您沒有「關閉」應用程序會發生什麼?也許你只需要關閉工作區:'pdApplication.ActiveWorkspace.Close(true)'。 – pascal
ActiveDocument沒有Close方法。也許ActiveWorkspace必須被轉換爲另一個對象類? – user2722077
PowerDesigner進程仍然存在於當前狀態的背景中。 – user2722077