取消
顯示結果 
搜尋替代 
您的意思是: 

Calling WPF from TestStand

Hello, I'm not a TestStand programmer so I don't know how NotifyStartOfModalDialogEx works, but I'm quite sure your WPF should be linked to the parent (that should be TestStand) to have a chance to be modal (like in the code from codeproject).

I would also modify the code this way:

 

public static void ShowSerialDialogWPF(SequenceContext seqContext, out string serialNumber, out bool continueTesting)
{

...

using(SerialDialog userInterfaceDialog = new SerialDialog())

{

System.Threading.Thread uiThread = new System.Threading.Thread(() =>
{
    userInterfaceDialog.ShowDialog();
});
uiThread.SetApartmentState(System.Threading.ApartmentState.STA);
uiThread.Start();
uiThread.Join();

 

serialNumber = userInterfaceDialog.Serial;

continueTesting = userInterfaceDialog.ContinueTesting;
}

...

}

 

HAGD

0 積分
11 條訊息(共 14 條)
1,084 檢視

I will try it.

 

Just a Quick question. Why are you using the using() statement?

 

Juan Navarro
0 積分
12 條訊息(共 14 條)
1,070 檢視

Hi, because I guess the window object is IDisposable, and so will be disposed anyway.

0 積分
13 條訊息(共 14 條)
1,066 檢視

It seems like the STA problem asked in the beginning returned. Cant figure out how to make the WPF STA without calling another thread which I assume is the problem to follow the windows forms format.

 

Also I cannot find a WPF dialog example for Teststand, only Forms.

 

Juan Navarro
0 積分
14 條訊息(共 14 條)
1,041 檢視