We have a requirement to use facebook connect on a touch screen kiosk tha开发者_Go百科t's running in windows in Kiosk Mode. There is not a physical keyboard on the kiosk. Any ideas on how to get a virtual keyboard that can be used to pass credentials to facebook so that we can authenticate users? Facebook does not seem to allow support authenticating users outside of their login page.
I found a very simple solution on Windows Form. The class SendKeys can simulate keyboard events.
http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.WINDOWS.FORMS.SENDKEYS.SEND);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV4.0%22);k(DevLang-CSHARP)&rd=true
The setup is a form with a WebBrowserControl and a bunch of buttons for the keyboard keys. Here's the event handler for a keyboard button.
private void buttonKey_Click(object sender, EventArgs e)
{
Control _sender = sender as Control;
if (_sender != null)
{
//focus the webBrowser
bool focusResult = false;
do
{
focusResult = webBrowser1.Focus();
if (!focusResult)
{
Thread.Sleep(100);
}
} while (!focusResult);
SendKeys.Send("{TAB}");
SendKeys.Send("+{TAB}");
SendKeys.Send("{RIGHT}");
SendKeys.Send(_sender.Text);
}
}
精彩评论