09-10-2013 11:41 AM
09-11-2013 08:22 AM
Hi MimiKLM,
I'd like to help you out if possible but unfortunately I'm having a little trouble wading through the acronyms. Is there any chance you could clarify exactly what you're trying to do and where you are having a problem?
If you can break it down a little I can hopefully point you in the right direction.
Best Regards,
Chris
09-11-2013 09:19 AM
It's possible, but a little tricky. You might be better off starting with one of our Windows Forms UIs and using the WPF Host control to host any WPF controls you also want to use. That said, if you want to go the more complicated route you can do the following:
1 - Add references to your project for all of the TestStand interop assemblies and set them to NOT embed interop types in the properties pane.
2 - Add a WindowsFormsHost for each TestStand control you want to use on your panel (You'll at least need one for the application manager)
3 - Add a Loaded event handler for the main window of your WPF application.
4 - here is an example of creating the applicationmgr control in such a case. though this is really just the beginning of creating a UI. there is a lot more work required.
private NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr mAppMgr;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
mAppMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr();
this.windowsFormsHost1.Child = mAppMgr;
mAppMgr.Start();
}
Hope this helps,
-Doug
09-16-2013 05:33 AM
Thanks a lot Doug
I've modified some of that code by adding the one line
this.grid1.Children.Add(host);)
to your function:
private NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr mAppMgr; private void WindowLoaded(object sender, RoutedEventArgs e) { System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); mAppMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr(); host.Child = mAppMgr; this.grid1.Children.Add(host); mAppMgr.Start(); }
I had a successful build but I've seen a warning shown below:
A reference was created to embedded interop assembly 'c:\Program Files\National Instruments\TestStand 2013\API\DotNet\Assemblies\CurrentVersion\NationalInstruments.TestStand.Interop.API.dll' because of an indirect reference to that assembly created by assembly 'c:\Program Files\National Instruments\TestStand 2013\API\DotNet\Assemblies\CurrentVersion\NationalInstruments.TestStand.Interop.UI.AxControls.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
What’s that?
09-16-2013 07:48 AM
09-16-2013 09:12 AM
@MimiKLM wrote:
Thanks a lot Doug
I've modified some of that code by adding the one line
this.grid1.Children.Add(host);)to your function:
private NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr mAppMgr; private void WindowLoaded(object sender, RoutedEventArgs e) { System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); mAppMgr = new NationalInstruments.TestStand.Interop.UI.Ax.AxApplicationMgr(); host.Child = mAppMgr; this.grid1.Children.Add(host); mAppMgr.Start(); }
I had a successful build but I've seen a warning shown below:
A reference was created to embedded interop assembly 'c:\Program Files\National Instruments\TestStand 2013\API\DotNet\Assemblies\CurrentVersion\NationalInstruments.TestStand.Interop.API.dll' because of an indirect reference to that assembly created by assembly 'c:\Program Files\National Instruments\TestStand 2013\API\DotNet\Assemblies\CurrentVersion\NationalInstruments.TestStand.Interop.UI.AxControls.dll'. Consider changing the 'Embed Interop Types' property on either assembly.
What’s that?
I used the designer to add the Windows Forms Host control so I did not need the line you added. You should change the settings (properties page for assembly references) to not embed interops for any of the TestStand assemblies. They are all already in the GAC and the embed feature does not work with enums so could lead to problems in the future.
-Doug
09-16-2013 09:14 AM
@MimiKLM wrote:
I understand thet warnings are more informational, and are not 'dangerous'.
BTW: How manu hosts shall I have? One for whole application or one for each control?
I think you are supposed to use one per control. You could theoretically add all of the activex controls on a Form control and then add the form to a single Windows Forms Host control, but I think you are generally supposed to use a separate host for each control instead. I'm not sure though. Feel free to look at Microsoft's documentation on MSDN to see what they recommend.
-Doug
09-16-2013 09:47 AM
Dug,
I set the Embed Interop Types to false. It's fine now.
I did expect some objects to appear on the XAML application window (as on the windows form app) but they didn't. I did created SequenceFiele View Manager and ExecutionViewManager, but they didn't appear on the main window.
09-16-2013 12:06 PM
@MimiKLM wrote:
Dug,
I set the Embed Interop Types to false. It's fine now.
I did expect some objects to appear on the XAML application window (as on the windows form app) but they didn't. I did created SequenceFiele View Manager and ExecutionViewManager, but they didn't appear on the main window.
Hmm, you might be better off creating the Windows Forms Host controls in the designer like I did, otherwise you probably have to set their size, location and visibility programmatically.
-Doug
11-13-2014 03:46 PM
Hi Doug,
Any chance you could give me more indications how to do next step?
How to create them in designer?
K.