06-19-2009 05:48 AM
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
06-19-2009 09:45 AM
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.
06-19-2009 10:01 AM
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
06-22-2009 09:43 AM
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.
06-23-2009 02:30 AM
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
06-23-2009 10:32 AM
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