NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create an instance of axApplicationMgr

Hi,

In my application there are lots of user control which is using axApplicationMgr and I need to keep the instance of axApplicationMgr commonly accessble to all these usercontrol for single instance.

So let me know how the instance of axApplicationMgr can be created without attaching to a Windows form.

Is it possible to create as

axApplicationMgr  obj = new axApplicationMgr();

 

I am doing code in dotnet(C#).

 

Regards,

Ceaser

0 Kudos
Message 1 of 6
(3,970 Views)

I don't know whether you can create it standalone, but a very easy alternative is to create a hidden form that only contains the application manager.

0 Kudos
Message 2 of 6
(3,959 Views)

Hi,

 

private AxApplicationMgr _axAppMgr = null;

_axAppMgr = new AxApplicationMgr();

_axAppMgr.CreateControl();

_axAppMgr.Enabled =
true;

_axAppMgr.Start();

 

When I tried this code it is creating the instance. But now I am not getting  

_ApplicationMgrEvents_DisplayExecutionEventHandler AxApplicationMgr events.

This event is propertly fired when the AxApplicationMgr is not kept globally.

 

I have tried with the method hidden form for creating  AxApplicationMgr  instance, it also doesn't work.

 

Can any one help in this matter?

 

Regards,

Ceaser

0 Kudos
Message 3 of 6
(3,956 Views)

 Hi,

 

I dunno if this would help but have had a look at the C# source code? (Start Menu>>National Instruments>>TestStand X.X>>User Interface>> C#>>) maybe it is being done there....

 

I am not well versed with C# so am not able to help out much.

.......^___________________^
....../ '---_BOT ____________ ]
...../_==O;;;;;;;;_______.:/
.....),---.(_(____)/.....
....// (..) ),----/....
...//____//......
..//____//......
.//____//......
..-------
0 Kudos
Message 4 of 6
(3,933 Views)

Hi,

Thanks for the reply I have checked the project.

But in that the ApplicationMgr is having only one to one relation(only used in that mainform).

For me one to many relationship is required.

 

Is this the right place to ask query related to dotnet and teststand?

 

Regards,

Ceaser

0 Kudos
Message 5 of 6
(3,924 Views)

How are you attaching the event to a callback? You need to specify the event delegate if you want to get your callback called.

 

Also I'm pretty sure putting the control on a form using the Visual Studio designer and creating the form, but not showing it is an easier way to accomplish what you are trying to do. If you are having trouble getting that working please let us know what the problem is, as it works for me. One thing you need to make sure you are doing is that the thread that creates the form must be an STA thread. To make your main thread an STA thread you must have the STAThread attribute on your main function as follows:

 

        [STAThread]
        static void Main(string[] args)
        {
            hiddenform myform = new hiddenform();

        }
 

 

Hope this helps,

-Doug

0 Kudos
Message 6 of 6
(3,916 Views)