How to Start Your WPF Application In Kiosk Mode

Start Your WPF Application In Kiosk ModeIn this article I’m going to cover a very simple example for creating a WPF application that runs in “kiosk mode.”

When running a WPF app on a kiosk the goal is to ensure that our application is running at all times and prevent malicious user tampering.  This includes filtering out system keystrokes like CTRL-ALT-DEL, gracefully handling reboots and providing a touchscreen keyboard.

The easiest way to accomplish this is to employ a capable kiosk software with support for locking down a native WPF app.  At the time of this writing KioskSimple is the only kiosk software to support securing a native WPF application and consuming it via MEF (.NET Managed Extensibility Framework).

WPF Kiosk ModeThere are several advantages to developing your kiosk application as a native application which include:

  • Employ robust retry logic for sensitive transactions and to account for a flakey internet connection
  • Design a responsive touchscreen UI and animations
  • Low bandwidth usage and minimal load on the central server because much of the processing can be performed on the kiosk
  • Deploy updates to a single kiosk without impacting other kiosks
  • Direct access to kiosk hardware devices
  • “Offline mode” can be supported for internet outages by caching data locally

In this article we’re going to cover how to create a simple .NET C# WPF “Hello World” kiosk application which can be locked down by KioskSimple.

Getting Your WPF App Running in KioskSimple

First lets cover the basics of running your WPF application in “kiosk mode” with KioskSimple.

The first thing you need to know is that KioskSimple locks down a .NET WPF User Control by consuming it via MEF.  If you’ve already created a WPF application you’ll need to convert it into a .NET User Control and implement our interface so it can be consumed by KioskSimple.

This is usually pretty easy to do, but if it’s over your head we can modify your application for you or just hold your hand through the integration process.  Just contact us for help.

The following sections are meant to get you up and running with an elementary KioskSimple application.  Here’s how it works…

This project uses the MVVM (Model View ViewModel) approach to creating a KioskSimple app, however you’re not limited to this method.

The following sections will refer to the C# interfaces IKioskSimpleWindowsApp and IKioskSimpleWindowsPluginHost.

Open your main ViewModel in the editor and add a reference to KioskSimpleModuleInterfaces

Now make the ViewModel class implement IKioskSimpleWindowsApp.

Right click the IKioskSimpleWindowsApp declaration and select ‘Interface’ then select ‘Implement Interface’. This will fill out the empty methods that will satisfy the IKioskSimpleWindowsApp interface in the main ViewModel class. For now comment out or remove the NotImplemented exceptions that get auto-generated.

Add the following line to the top of the class.

Replace the current public void SetPluginHost(IKioskSimpleWindowsPluginHost host) method with this one.

Your MainViewModel class should now look like this.

Hello World WPF Kiosk Example

We put together a Hello World Example WPF Kiosk Example to get you started quickly.  You can download full example source code as a Visual Studio solution here (Download “KioskSimple Hello World Example – .NET C# WPF”).

You’ll need to install the free demo of KioskSimple before you can try this example.

Here are the steps to build the example in Visual Studio.

  1. Download the full example source code as a Visual Studio solution here (“KioskSimple Hello World Example – .NET C# WPF”).
  2. Open the solution in Visual Studio
  3. Compile the project. Make sure to build the example for the correct processor type (x64 or x86).  The example is processor specific.  This can easily be configured from Visual Studio by changing the Active Solution Platform setting under the Configuration Manager screen.
  4. Copy only the ExampleAppHelloWorld.dll and KioskSimpleClientFramework.dll from the output directory into the directory C:\ProgramData\RedSwimmer\KioskSimple\App (the default location for client WPF applications). The name of the folder MUST be “App”.

Now to run the WPF application example in kiosk mode:

  1. Start the KioskSimple Configuration Tool
  2. Select TOOLS from the left pane menu. Click the OPTIONS icon button. Under the KioskSimple Lockdown Mode section, set the Lockdown Mode to APP.
  3. Save your settings and close the KioskSimple Configuration Tool
  4. Start KioskSimple in Test Mode to test the example application.

And you should see this:

ExampleHelloWorldWPF

Here’s the XAML for the main View:

Here’s the main ViewModel class:

You can download the full example source code as a Visual Studio solution here (Download “KioskSimple Hello World Example – .NET C# WPF”).

WPF Kiosk Mode SupportWhat’s Next?

You can use the free demo of KioskSimple as long as you like.  If you want help getting your WPF application to run in kiosk mode please don’t hesitate to contact us.

We can even modify your application for you, or just hold your hand through the integration process.  We offer free developer phone and email tech support.

Subscribe to our blog updates today to keep up to date on our latest content.

Be Sociable, Share!
Andrew Savala
Follow me

Andrew Savala

Andrew Savala is the CEO of RedSwimmer Inc., creators of the kiosk lockdown software KioskSimple. Andrew has been developing kiosk software since 2007, with an emphasis on self-service retail payment applications.
Andrew Savala
Follow me

Author: Andrew Savala

Andrew Savala is the CEO of RedSwimmer Inc., creators of the kiosk lockdown software KioskSimple. Andrew has been developing kiosk software since 2007, with an emphasis on self-service retail payment applications.

One thought on “How to Start Your WPF Application In Kiosk Mode”

Comments are closed.