jhvirtualkeyboard_binaries.zip
JHLib.dll
JHVirtualKeyboard.dll
JHVirtualKeyboardDemoApp.exe
jhvirtualkeyboard_source.zip
JHVirtualKeyboard
bin
Debug
Release
ClassDiagram1.cd
Images
bgGreenTexture2.jpg
TextureR40x40.png
JHLib
bin
Debug
Release
obj
Debug
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Release
DesignTimeResolveAssemblyReferencesInput.cache
TempPE
Properties
JHVirtualKeyboardDemoApp
bin
Debug
DLib.dll
DLib.pdb
DVirtualKeyboard.dll
DVirtualKeyboard.pdb
DVirtualKeyboardDemoApp.pdb
DVirtualKeyboardDemoApp.vshost.exe.manifest
FsRichTextBox.dll
FsRichTextBox.pdb
JHVirtualKeyboardDemoApp.vshost.exe
JHVirtualKeyboardDemoApp.vshost.exe.manifest
Release
JHVirtualKeyboardDemoApp.vshost.exe
JHVirtualKeyboardDemoApp.vshost.exe.manifest
DVirtualKeyboardDemoApp.suo
Images
iconKeyboard_16x9.png
TextureR40x40.png
JHVirtualKeyboardDemoApp.suo
obj
x86
Debug
build.force
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
DVirtualKeyboardDemoApp_MarkupCompile.i.cache
JHVirtualKeyboardDemoApp_MarkupCompile.i.cache
TempPE
Properties.Resources.Designer.cs.dll
Release
DesignTimeResolveAssemblyReferencesInput.cache
JHVirtualKeyboardDemoApp_MarkupCompile.i.cache
TempPE
Properties.Resources.Designer.cs.dll
Properties
Settings.settings
KeyAssignmentSets
Properties
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using JHVirtualKeyboard;
namespace JHVirtualKeyboardDemoApp
{
/// <summary>
/// Interaction logic for our MainWindow.
/// </summary>
public partial class MainWindow : Window, IVirtualKeyboardInjectable
{
public MainWindow()
{
InitializeComponent();
// Remember which text field has the current focus.
_txtLastToHaveFocus = txtBox;
// Set up our event handlers.
this.ContentRendered += OnContentRendered;
this.LocationChanged += OnLocationChanged;
this.Closing += new System.ComponentModel.CancelEventHandler(OnClosing);
}
#region Event Handlers
#region ContentRendered event handler
/// <summary>
/// Handle the ContentRendered event.
/// </summary>
void OnContentRendered(object sender, EventArgs e)
{
// If the Virtual Keyboard was up (being shown) when this application was last closed,
// show it now.
if (Properties.Settings.Default.IsVKUp)
{
ShowTheVirtualKeyboard();
}
// Put the initial focus on our first text field.
txtBox.Focus();
}
#endregion
#region LocationChanged event handler
/// <summary>
/// Handle the LocationChanged event, which is raised whenever the application window is moved.
/// </summary>
void OnLocationChanged(object sender, EventArgs e)
{
// Do this if, when your user moves the application window around the screen,
// you want the Virtual Keyboard to move along with it.
if (_virtualKeyboard != null)
{
_virtualKeyboard.MoveAlongWith();
}
}
#endregion
#region GotFocus event handlers
private void txtBox_GotFocus(object sender, RoutedEventArgs e)
{
// Remember that the plain TextBox was the last to receive focus.
_txtLastToHaveFocus = txtBox;
}
private void txtrichBox_GotFocus(object sender, RoutedEventArgs e)
{
// Remember that the RichTextBox was the last to receive focus.
_txtLastToHaveFocus = txtrichBox;
}
#endregion
#region btnVK_Click
/// <summary>
/// Handle the event that happens when the user clicks on the Show Virtual Keyboard button.
/// </summary>
private void btnVK_Click(object sender, RoutedEventArgs e)
{
ShowTheVirtualKeyboard();
}
#endregion
#region btnClose_Click
/// <summary>
/// Handle the event that happens when the user clicks on the Close button.
/// </summary>
private void btnClose_Click(object sender, RoutedEventArgs e)
{
// Close this application.
Close();
}
#endregion
#region Closing event handler
/// <summary>
/// Handle the Closing event.
/// </summary>
void OnClosing(object sender, System.ComponentModel.CancelEventArgs e)
{
bool isVirtualKeyboardUp = _virtualKeyboard != null && VirtualKeyboard.IsUp;
Properties.Settings.Default.IsVKUp = isVirtualKeyboardUp;
Properties.Settings.Default.Save();
}
#endregion
#endregion Event Handlers
#region ShowTheVirtualKeyboard
/// <summary>
/// Put up the DVirtualKeyboard
/// </summary>
public void ShowTheVirtualKeyboard()
{
// (Optional) Enable it to remember which language it was set to last time, so that it can preset itself to that this time also.
VirtualKeyboard.SaveStateToMySettings(Properties.Settings.Default);
// Show the keyboard.
VirtualKeyboard.ShowOrAttachTo(this, ref _virtualKeyboard);
}
#endregion
#region Implementation for interface IVirtualKeyboardInjectable
public System.Windows.Controls.Control ControlToInjectInto
{
get { return _txtLastToHaveFocus; }
}
#endregion Implementation for interface IVirtualKeyboardInjectable
#region fields
private VirtualKeyboard _virtualKeyboard;
private Control _txtLastToHaveFocus;
#endregion fields
}
}
|
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.