private void OnOskKeyPressed(string charRepresentation, OskSpecialKey specialKey) { try { if (specialKey == OskSpecialKey.Done) { this.Dispatcher.BeginInvoke(new Action(() => { this.DialogResult = true; this.Close(); })); } } catch (Exception ex) { ErrorHandler.HandleException(ex); } }
protected void RaiseOskKeyPressedEvent(string charRepresentation, OskSpecialKey specialKey) { if (SystemSoundPlayer.IsInitialised) SystemSoundPlayer.Instance().PlaySound(Classes.SystemSound.LetterClick); if (this.AttachedTextBox != null) { var txt = this.AttachedTextBox; if (specialKey == OskSpecialKey.Clear) { txt.Text = ""; } else if (specialKey == OskSpecialKey.Backspace) { if (txt.Text != null && txt.Text.Length > 0) { txt.Text = txt.Text.Remove(txt.Text.Length - 1); } } else { if (txt.Text == null) txt.Text = ""; txt.Text += charRepresentation; } } if (this.OnOskKeyPressed != null) this.OnOskKeyPressed(charRepresentation, specialKey); }
private void OnOskKeyPressed(string charRepresentation, OskSpecialKey specialKey) { try { if (specialKey == OskSpecialKey.Done && CurrentViewState == ViewState.SetupSearch) { this.Dispatcher.BeginInvoke(new Action(() => { PerformSearch(); })); } else if (specialKey == OskSpecialKey.Exit) { this.Close(); } } catch (Exception ex) { ErrorHandler.HandleException(ex); } }