Ejemplo n.º 1
0
        private static void rubOutHandler(object sender, RoutedEventArgs e)
        {
            KeyboardPanel panel = (KeyboardPanel)sender;

            panel.rubOut();
            e.Handled = true;
        }
Ejemplo n.º 2
0
 public SoftKeyboardPlugin(IMessageDispatcher remote, IUIThreadDispatcher uiThreadDispatcher, string contextString, bool isNumeric)
 {
     this._remote             = remote;
     this._uiThreadDispatcher = uiThreadDispatcher;
     uiThreadDispatcher.BlockingInvoke(() =>
     {
         keyboard              = new KeyboardPanel(contextString, remote, isNumeric);
         pluginContainer       = new Viewbox();
         pluginContainer.Child = keyboard;
     });
 }
Ejemplo n.º 3
0
        private static void keyTypedHandler(object sender, RoutedEventArgs e)
        {
            KeyboardPanel panel    = (KeyboardPanel)sender;
            CharacterKey  key      = (CharacterKey)e.OriginalSource;
            string        text     = key.getShiftAdjustedValue();
            Typeface      typeface = new Typeface(panel.textBox.FontFamily, panel.textBox.FontStyle, panel.textBox.FontWeight, panel.textBox.FontStretch);
            FormattedText ft       = new FormattedText(panel.textBox.Text, System.Globalization.CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, panel.textBox.FontSize, Brushes.Black);

            if (ft.Width > panel.textBox.ActualWidth - 10)
            {
                isOverflow = true;
                panel.textBox.Background = new SolidColorBrush(Colors.Red);
                panel.textBox.IsReadOnly = true;
                panel.sendUpdateMessage();
                panel.contextLabel.Content = "Too many characters: (Use red arrow key to rub out)";
            }
            else
            {
                panel.type(text);
            }
            e.Handled = true;
        }