NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

UserChanged Event does not execute

Solved!
Go to solution

Why does the UserChanged Event not execute when the user is changed with the IEngine.CurrentUser property within an operator interface?  I noticed that it will execute when the login/logout methods happen but not when it is changed directly.

 

Also, is it possible to force this event programmatically so the code in the callback tied to this event will execute (as a work around?).

 

Thanks,

Paul

 

TS 4.0.1

LV 8.5.1

0 Kudos
Message 1 of 3
(3,248 Views)
Solution
Accepted by paulmw

Paul,

 

the reason for the event not to be fired is that IEngine.CurrentUser is a property of the engine and the event is controlled by the Application Manager. Changing the value of the property will therefore not create the event on its own.

If you are working in an UI, it is recommended to use the manager controls; the Appication Manager supplies a "Login" method:

Logs in the user by running the LoginLogout Front-End callback. This method does not wait for the callback to execute. Use the ApplicationMgr.UserChanged event to determine whether the login was successful.


The disadvantage is that the LoginLogout Front-End creates the login dialogby default. If you don't want to have that dialo, you should consider replacing it with your own Front-End. But please don't alter the default callback, but override it using the User-directory!

 

hope this helps,

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 3
(3,222 Views)

Thanks Norbert,

I have considered these options already and experimented with them and they do not yeild the results I was looking for because of where the logout & login is occuring.  I want to re-login a user if the PreUUT serial number dialog has been active for more than X sec/min.  So, this means it is in the midle of an execution.  I have concidered adding a call to the Front-End callback as part of the process model but prefered to implement it in the operator interface because this functionality is only required on the production floor.  Also, for this case I would prefer to not modify the process model or require developers to add code to their sequence development that for each instance would have to be validated.  So, it is a bit unique to try and logout and login a user from the UI durring an executuion.

 

Using the Application Manager login methods within the UI were asyncronous and didn't allow the running sequence to pause while the login/out was occuring.  Also, the dialog wouldn't show if UI was in a callback waiting for the logout/login to finish by polling the loginrunning properties.

 

In any case I have my UI operation as desired.  I copied the same code that updates the GUI from UserChanged event to the event that is changing the IEngine.CurrentUser.  Also, as an FYI for others, I also have to update the Locals.StationInfo.LoginName of the root at this time too so it shows up in the report (needed if the user changes).

 

Thanks for your eplanation to why the event doesn't fire.

Paul

Message 3 of 3
(3,217 Views)