02-15-2013 07:07 AM
Has anyone an idea how to hide an adapter programmatically (using C#) in the custom Editor of TestStand?
I suppose this can be done using the ApplicationMgr…
Patrick
02-15-2013 07:34 AM - edited 02-15-2013 07:35 AM
Hm, the easiest thing is to disable it in the general station settings of the adapter.
Norbert
02-15-2013 07:43 AM
I know this possible via the GUI, but I want to do it via the program interface in C#.
I want to build a TestStand custom interface and limit the number of available adapters conform the privilege of the current user.
02-15-2013 08:04 AM
The setting is stored in the TestExec.ini file in the TestStand CFG directory.
Once configured, it is also true for custom UIs.
So either configure it on the specific machine or copy the settings file from a machine where it is configured. This seems to be the easiest solution.
You can also modify the file by hand since it is ASCII. Search for _HTBasicAdp_Hidden and set it to "true".
The option to set it programmatically is the last option if you want the user of your UI to be able to switch this setting....
Norbert
02-15-2013 08:15 AM
Thanks for your quick reply.
But, indeed I want to do it from code. The privileges for all our users are stored into an SQL database. When a user logins, the database is consulted to retrieve all the privileges, one of the privileges specifies if a specific adapter is available for the current logged in developer. So, via some C# code, I want to hide some of the adapters.
I do not like the idea to edit the .ini file behind the scenes...
I think, this is possible via the application manager, but it is not easy to figure out how to do this, any suggestion is highly appreciated.
I have tried something like the following.
ApplicationMgrConnections applicationMgrConnections = m_AxApplicationMgr.Connections;
AdapterListConnections adapterListConnections = applicationMgrConnections.AdapterList;
The adapterListConnections is a valid com object...
Thanks in advance.
Patrick
02-15-2013 08:26 AM
Ok, since you want to go the hard way:
You have to dig down till you have access to the property Adapter.Hidden:
Adapter.Hidden
Specifies if the adapter is present in the list of adapters. This property is used to hide the adapter.
Set this property to True to hide the adapter in controls that display the list of adapters.
hope this helps
Norbert