windows 8.1 assigned access for Desktop App

2019-07-04 11:06发布

问题:

I have a Desktop Application written in WPF (originally for Windows 7) that I would like to run in Kiosk (Assign Access mode) on a Microsoft Surface Pro 2. The assigned access feature looked perfect, but it doesn't support non-store apps.

I just need a way to prevent the user from switching to another app or getting access to the OS etc.

Possible?

回答1:

  1. Make your application fullscreen as shown here: full screen wpf

  2. In your main window constructor subscribe on Deactivate event or override OnDeactivate method:

        Deactivated += delegate(object sender, EventArgs e) {
            Activate();
        };
    
  3. You would also want to prevent the window from Alt+F4 closing by handling the Closing event on such a way:

        Closing += delegate(object sender, CancelEventArgs e)
        {
            if(!Environment.HasShutdownStarted)
                e.Cancel = true;
        };
    

After all done, the application is closable only by task manager, sign out and shutdown.