I am trying to write a new editor.exe, using wpf. In the main window, I add a button. When I click the button, I create a new TestPlan, add a SCPIRegexStep to the TestPlan and execute the TestPlan.
I have already set a scpiInstrument with VISA address by the Keysight GUI Editor.exe.
But the program didn’t call the Open() method of the ScpiInstrument. I debug with the source code of OpenTAP 9.8.15, and found that the progrom called ResourceTaskManager.OpenResource, and execute the first code “await canStart;” and exit the function. The following code after the first line of the function is not called.
If I create a console application, and write the same code, the console application can send scpi command the the scpiInstrument successfully.
The code I use is similar to the example of BuildTestPlan.Api, shown as follow:
private void Button_Click(object sender, RoutedEventArgs e)
{
PluginManager.SearchAsync();
SessionLogs.Initialize(“console_log.txt”);
TestPlan myTestPlan = new TestPlan();
myTestPlan.ChildTestSteps.Add(new SCPIRegexStep());
string myFilePath = myTestPlan.Name + "3.TapPlan";
myTestPlan.Save(myFilePath);
List<ResultListener> resultListeners = new List<ResultListener>();
resultListeners.Add(new LogResultListener());
myTestPlan.Execute(resultListeners);
SessionLogs.Rename("sessionLog.txt");
MessageBox.Show("Press any key to exit.");
}
Can any one help me on this issue? Thanks a lot.