Inheritance: System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector
Ejemplo n.º 1
0
        private void Keyboard_GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            KeyboardEntryControl keyboard = GetKeyboardControl(borderControl.ContextMenu);

            CaretIndex = keyboard.textBoxLine.CaretIndex;
            UpdateCaret();
            changeCount = 0;
            //ShowCaret(true);
        }
Ejemplo n.º 2
0
 private void borderControl_PreviewMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (UseContextMenuEditing)
     {
         if ((PromptType == CustomTextBoxType.Keyboard) ||
             (PromptType == CustomTextBoxType.Password))
         {
             SetKeyboardContextMenu();
             ContextMenu          contextMenu = borderControl.ContextMenu;
             KeyboardEntryControl keyboard    = GetKeyboardControl(contextMenu);
             if (PromptType == CustomTextBoxType.Password)
             {
                 keyboard.UsePasswordTextField = true;
             }
             if (keyboard != null)
             {
                 keyboard.OriginalText = Text;
             }
             contextMenu.IsOpen = true;
             ChangeSelectedIndex(e);
             e.Handled = true;
         }
         else if ((PromptType == CustomTextBoxType.Currency) ||
                  (PromptType == CustomTextBoxType.IntegerNumeric) ||
                  (PromptType == CustomTextBoxType.Percentage) ||
                  (PromptType == CustomTextBoxType.FloatNumeric) ||
                  (PromptType == CustomTextBoxType.PhoneNumber))
         {
             SetNumberPadContextMenu();
             ContextMenu        contextMenu = borderControl.ContextMenu;
             NumberEntryControl numPad      = GetNumberPadControl(contextMenu);
             numPad.UseDecimalPoint =
                 ((PromptType == CustomTextBoxType.FloatNumeric) ||
                  (PromptType == CustomTextBoxType.Percentage));
             numPad.DisplayAsPercentage =
                 (PromptType == CustomTextBoxType.Percentage);
             numPad.DisplayAsCurrency =
                 (PromptType == CustomTextBoxType.Currency);
             numPad.buttonBackspace.IsEnabled =
                 ((PromptType == CustomTextBoxType.IntegerNumeric) ||
                  (PromptType == CustomTextBoxType.FloatNumeric) ||
                  (PromptType == CustomTextBoxType.PhoneNumber));
             numPad.OriginalText = Text;
             contextMenu.IsOpen  = true;
             ChangeSelectedIndex(e);
             e.Handled = true;
         }
     }
 }
Ejemplo n.º 3
0
        private void KeyboardBorder_Initialized(object sender, EventArgs e)
        {
            Border border = (sender as Border);

            border.BorderThickness = new Thickness(1);
            border.CornerRadius    = new CornerRadius(4);
            border.Background      = ConfigurationManager.ApplicationBackgroundBrush;
            border.BorderBrush     = ConfigurationManager.BorderBrush;
            KeyboardEntryControl keyboard = border.Child as KeyboardEntryControl;

            keyboard.CompactModeOwner = this;
            keyboard.ShiftMode        = KeyboardShiftMode;
            if (ContextMenuInitialized != null)
            {
                ContextMenuInitialized.Invoke(this, new EventArgs());
            }
        }
Ejemplo n.º 4
0
        public static string PromptKeyboard(string fieldName, string defaultValue, bool isPassword, ShiftMode keyboardShiftMode)
        {
            KeyboardEntryControl control = new KeyboardEntryControl();
            PosDialogWindow      window  = new PosDialogWindow(control, fieldName);

            control.UsePasswordTextField = isPassword;
            control.ShiftMode            = keyboardShiftMode;
            control.Text      = defaultValue;
            window.IsClosable = false;
            window.Width      = 835;
            window.Height     = 390;
            window.ShowDialogForActiveWindow();
            if (control.WasCanceled)
            {
                return(null);
            }
            if (control.Text == null)
            {
                return("");
            }
            return(control.Text);
        }
Ejemplo n.º 5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mainPane = ((System.Windows.Controls.DockPanel)(target));
                return;

            case 2:
                this.Configuration = ((PosControls.ConfigurationManager)(target));
                return;

            case 3:
                this.dragScrollViewer = ((PosControls.DragScrollViewer)(target));
                return;

            case 4:
                this.flowDocumentScroll = ((System.Windows.Controls.FlowDocumentScrollViewer)(target));
                return;

            case 5:
                this.keyboardControl = ((PosControls.KeyboardEntryControl)(target));

            #line 31 "..\..\..\CommandShellControl.xaml"
                this.keyboardControl.EnterPressed += new System.EventHandler(this.keyboardControl_EnterPressed);

            #line default
            #line hidden

            #line 31 "..\..\..\CommandShellControl.xaml"
                this.keyboardControl.ConsoleClear += new System.EventHandler(this.keyboardControl_ConsoleClear);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 6
0
 private KeyboardEntryControl GetKeyboardControl(DependencyObject parentDependencyObject)
 {
     if (parentDependencyObject == null)
     {
         return(null);
     }
     for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parentDependencyObject); i++)
     {
         DependencyObject depObject = VisualTreeHelper.GetChild(parentDependencyObject, i);
         if (depObject is KeyboardEntryControl)
         {
             return(depObject as KeyboardEntryControl);
         }
         if (VisualTreeHelper.GetChildrenCount(depObject) > 0)
         {
             KeyboardEntryControl childFound = GetKeyboardControl(depObject);
             if (childFound != null)
             {
                 return(childFound);
             }
         }
     }
     return(null);
 }
Ejemplo n.º 7
0
        private void SetKeyboardContextMenu()
        {
            ControlTemplate controlTemplate =
                Resources.GetControlTemplate("keyboardControlTemplate");

            if (controlTemplate != null)
            {
                ContextMenu contextMenu = new ContextMenu();
                contextMenu.Tag                = "Keyboard";
                contextMenu.Template           = controlTemplate;
                contextMenu.Placement          = PlacementMode.Bottom;
                contextMenu.PlacementTarget    = borderControl;
                contextMenu.LostKeyboardFocus += Keyboard_LostKeyboardFocus;
                contextMenu.GotKeyboardFocus  += Keyboard_GotKeyboardFocus;
                borderControl.ContextMenu      = contextMenu;
                contextMenu.ApplyTemplate();
                KeyboardEntryControl control =
                    GetKeyboardControl(contextMenu);
                control.MaxLength          = MaxLength;
                control.CompactModeOwner   = this;
                control.MaxLength          = MaxLength;
                control.CaretUpdateNeeded += Keyboard_CaretUpdateNeeded;
            }
        }