Ejemplo n.º 1
0
        public static int?PromptNumber(string fieldName, int?defaultValue)
        {
            NumberEntryControl control = new NumberEntryControl();
            PosDialogWindow    window  = new PosDialogWindow(control, fieldName);

            if (defaultValue.HasValue)
            {
                control.Text = "" + defaultValue.Value;
            }
            else
            {
                control.Text = "";
            }
            control.SetDefaultEnterEventHandler();
            window.IsClosable = true;
            window.Width      = 210;
            window.Height     = 340;
            window.ShowDialogForActiveWindow();
            int?value = null;

            if (!window.ClosedByUser)
            {
                try
                {
                    value = Convert.ToInt32(control.Text);
                }
                catch
                {
                }
            }
            return(value);
        }
        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 = ((PointOfSale.ConfigurationManager)(target));
                return;

            case 3:
                this.comboBoxMeasuringUnits = ((PosControls.PushComboBox)(target));

            #line 27 "..\..\..\ItemIngredientAddControl.xaml"
                this.comboBoxMeasuringUnits.SelectedIndexChanged += new System.EventHandler(this.comboBoxMeasuringUnits_SelectedIndexChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.numberEntryControl = ((PosControls.NumberEntryControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 3
0
        public static double?PromptCurrency(string fieldName, double?defaultValue)
        {
            NumberEntryControl control = new NumberEntryControl();
            PosDialogWindow    window  = new PosDialogWindow(control, fieldName);

            control.SetDefaultEnterEventHandler();
            control.DisplayAsCurrency = true;
            control.FloatValue        = defaultValue;
            window.IsClosable         = true;
            window.Width  = 210;
            window.Height = 340;
            window.ShowDialogForActiveWindow();
            double?value = null;

            if (!window.ClosedByUser)
            {
                try
                {
                    value = Convert.ToDouble(StripCurrencySymbols(control.Text));
                }
                catch
                {
                }
            }
            return(value);
        }
Ejemplo n.º 4
0
        void NumberPad_ContextMenu_Opened(object sender, RoutedEventArgs e)
        {
            NumberEntryControl numPad = GetNumberPadControl(borderControl.ContextMenu);

            numPad.SetCaretIndexToEnd();
            CaretIndex = numPad.textBoxValue.CaretIndex;
            UpdateCaret();
            changeCount = 0;
            //ShowCaret(true);
            if (PromptType == CustomTextBoxType.IntegerNumeric)
            {
                numPad.SetCaretIndexToEnd();
            }
        }
Ejemplo n.º 5
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.º 6
0
        private void NumberPadBorder_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;
            NumberEntryControl numberPad = border.Child as NumberEntryControl;

            numberPad.CompactModeOwner = this;
            numberPad.SetCaretIndex(CaretIndex);
            if (ContextMenuInitialized != null)
            {
                ContextMenuInitialized.Invoke(this, new EventArgs());
            }
        }
Ejemplo n.º 7
0
        void NumberPad_ContextMenu_Closed(object sender, RoutedEventArgs e)
        {
            if ((PromptType == CustomTextBoxType.Percentage) && (Text != null))
            {
                Text = Text.Replace(".%", ".0%");
                if (!Text.Contains("."))
                {
                    Text = Text.Replace("%", ".0%");
                }
            }
            if ((borderControl.ContextMenu == null) || !borderControl.ContextMenu.IsOpen)
            {
                ShowCaret(false);
            }
            ContextMenu        contextMenu = borderControl.ContextMenu;
            NumberEntryControl numPad      = GetNumberPadControl(contextMenu);

            if (numPad.OriginalText != numPad.Text)
            {
                DoCommitEditEvent();
            }
        }
Ejemplo n.º 8
0
        private void SetNumberPadContextMenu()
        {
            ControlTemplate controlTemplate =
                Resources.GetControlTemplate("numberPadControlTemplate");

            if (controlTemplate != null)
            {
                ContextMenu contextMenu = new ContextMenu();
                contextMenu.Tag             = "NumberPad";
                contextMenu.Template        = controlTemplate;
                contextMenu.Placement       = PlacementMode.Bottom;
                contextMenu.PlacementTarget = borderControl;
                contextMenu.Opened         += NumberPad_ContextMenu_Opened;
                contextMenu.Closed         += NumberPad_ContextMenu_Closed;
                borderControl.ContextMenu   = contextMenu;
                contextMenu.ApplyTemplate();
                NumberEntryControl control = GetNumberPadControl(contextMenu);
                control.CompactModeOwner   = this;
                control.MaxLength          = MaxLength;
                control.CaretUpdateNeeded +=
                    NumberPad_CaretUpdateNeeded;
            }
        }
Ejemplo n.º 9
0
        public static double?PromptPercentage(DependencyObject parentControl, string fieldName, double?defaultValue)
        {
            NumberEntryControl control     = new NumberEntryControl();
            PosDialogWindow    window      = new PosDialogWindow(control, fieldName);
            Window             ownerWindow = GetWindow(parentControl);

            control.SetDefaultEnterEventHandler();
            control.DisplayAsPercentage = true;
            control.UseDecimalPoint     = true;
            control.FloatValue          = defaultValue;
            window.IsClosable           = true;
            window.Width  = 210;
            window.Height = 340;
            if (ownerWindow is IShadeable)
            {
                (ownerWindow as IShadeable).ShowShadingOverlay = true;
            }
            window.ShowDialog(ownerWindow);
            if (ownerWindow is IShadeable)
            {
                (ownerWindow as IShadeable).ShowShadingOverlay = false;
            }
            double?value = null;

            if (!window.ClosedByUser)
            {
                try
                {
                    value = Convert.ToDouble(control.Text.Replace("%", "")) / 100;
                }
                catch
                {
                }
            }
            return(value);
        }
Ejemplo n.º 10
0
 private NumberEntryControl GetNumberPadControl(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 NumberEntryControl)
         {
             return(depObject as NumberEntryControl);
         }
         if (VisualTreeHelper.GetChildrenCount(depObject) > 0)
         {
             NumberEntryControl childFound = GetNumberPadControl(depObject);
             if (childFound != null)
             {
                 return(childFound);
             }
         }
     }
     return(null);
 }
Ejemplo n.º 11
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 = ((PointOfSale.ConfigurationManager)(target));
                return;

            case 3:
                this.labelAmountDueLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.labelSubTotal = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.labelCouponAmount = ((System.Windows.Controls.Label)(target));
                return;

            case 6:
                this.labelDiscountAmount = ((System.Windows.Controls.Label)(target));
                return;

            case 7:
                this.labelTaxAmount = ((System.Windows.Controls.Label)(target));
                return;

            case 8:
                this.labelTotalAmount = ((System.Windows.Controls.Label)(target));
                return;

            case 9:
                this.labelAmountPayed = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.labelAmountDue = ((System.Windows.Controls.Label)(target));
                return;

            case 11:
                this.numberEntryControl = ((PosControls.NumberEntryControl)(target));
                return;

            case 12:
                this.buttonCash = ((PosControls.PushButton)(target));

            #line 110 "..\..\..\TicketCashoutPaymentControl.xaml"
                this.buttonCash.Selected += new System.EventHandler(this.Button_Selected);

            #line default
            #line hidden
                return;

            case 13:
                this.buttonCheck = ((PosControls.PushButton)(target));

            #line 111 "..\..\..\TicketCashoutPaymentControl.xaml"
                this.buttonCheck.Selected += new System.EventHandler(this.Button_Selected);

            #line default
            #line hidden
                return;

            case 14:
                this.buttonCreditCard = ((PosControls.PushButton)(target));

            #line 112 "..\..\..\TicketCashoutPaymentControl.xaml"
                this.buttonCreditCard.Selected += new System.EventHandler(this.Button_Selected);

            #line default
            #line hidden
                return;

            case 15:
                this.buttonGiftCard = ((PosControls.PushButton)(target));

            #line 113 "..\..\..\TicketCashoutPaymentControl.xaml"
                this.buttonGiftCard.Selected += new System.EventHandler(this.Button_Selected);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }