I need to show form as top level system-wide, e.g. over /all/ other windows on screen. I do realize this is usually /bad UI practice/, but I have very specific scenario in mind.
We intend to use normal Windows PCs for POS cash registrators. There is an option on the screen to open cash drawer. It would be rather bad for someone just to press something on a screen and get access to money when clerk isn't looking. So we equiped PCs with RFID readers and each clerk has his/her own RFID card which will be used for authentication.
I need however an mechanism to lock the computer (or make it unusable) when clerk goes away. Logging off seems too much of a nuisance.
Any ideas welcome.
LP, Dejan
To display a form modally use the ShowDialog method.
A systems model is a collection of elements that are interconnected in some specific way.
ShowDialog() Shows the form as a modal dialog box. ShowDialog(IWin32Window) Shows the form as a modal dialog box with the specified owner.
Add logic to the click event to re-open the modal after the post back OR look for an alternative method of posting back to the server such as using AJAX. If you want to do it via AJAX, remove the OnClick event from the button. Add a [WebMethod] to your code behind and call that webmethod using $. ajax.
Well, after a day of trial and error I came to sort of solution.
It involves the following steps:
1. When "Lock" button is pressed new (empty) /desktop/ is created. Program is run in this desktop with full screen form and login procedure. There is nothing else to switch to or run on this desktop.
2. Task manager is disabled via registry. Of course, somebody uninvited can still access the Ctrl-Alt-Delete menu, but there is nothing of particular harm he can do there.
3. Alt-F4 and such are disabled.
4. When authentication is made, program switches back to original desktop and everything proceeds as normal.
There is some P/Invoking required, of course. If someone wants to do something similar, perhaps s/he will find my bare bones example helpful - link text
LP, Dejan
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With