NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

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 Kudos
Message 11 of 14
(749 Views)

I will try it.

 

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

 

Juan Navarro
0 Kudos
Message 12 of 14
(735 Views)

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

0 Kudos
Message 13 of 14
(731 Views)

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 Kudos
Message 14 of 14
(706 Views)