03-10-2021 12:56 AM
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
03-11-2021 09:52 AM
I will try it.
Just a Quick question. Why are you using the using() statement?
03-11-2021 10:37 AM
Hi, because I guess the window object is IDisposable, and so will be disposed anyway.
03-17-2021 05:03 PM
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.