can you create a event for a dialog before it shows?

HI Guys,
Is it possible to create an event which you call rather than to see if the dialog is required.

I have made a Please Wait dialog which works really well however some times it is only flashed onto the screen and is a bit annoying.

I would like something like this

’ code to see if it is worth showing the dialog at all - probably using a dictionary of previous times it was displayed given the window it was called from

if true then
end if


I can use a method in the session called PreShow and call the dialog from there but I was wondering if it is possible?

Also out of interest is it possible to send variable to the dialog show
I.e. “this is a required string”, 123456 , CurrentMethodName )