public EntryBoxValidationButton(Window pSourceWindow, String pLabelText, KeyboardMode pKeyboardMode, string pRule, bool pRequired, string pIconFile = "")
            : base(pSourceWindow, pLabelText)
        {
            //Settings
            string iconSelectRecord = FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], @"Icons/Windows/icon_window_select_record.png"));
            string iconFile         = (pIconFile != string.Empty) ? pIconFile : iconSelectRecord;

            //Init Button
            _button = GetButton(iconFile);

            //EntryValidation
            _entryValidation = new EntryValidation(pSourceWindow, pKeyboardMode, pRule, pRequired)
            {
                Label = _label, LabelText = _label.Text
            };
            _entryValidation.ModifyFont(_fontDescription);
            //Started Validate
            _entryValidation.Validate();

            //Pack Hbox
            _hbox.PackStart(_entryValidation, true, true, 0);
            _hbox.PackStart(_button, false, false, 0);
            //Init Keyboard
            InitKeyboard(_entryValidation);
        }
Example #2
0
        public EntryBoxValidation(Window pSourceWindow, String pLabelText, KeyboardMode pKeyboardMode, string pRule, bool pRequired)
            : base(pSourceWindow, pLabelText)
        {
            //EntryValidation
            _entryValidation = new EntryValidation(pSourceWindow, pKeyboardMode, pRule, pRequired)
            {
                Label = _label, LabelText = _label.Text
            };
            _entryValidation.ModifyFont(_fontDescription);
            //Started Validate
            _entryValidation.Validate();

            //Pack
            _hbox.PackStart(_entryValidation, true, true, 0);
            //Init Keyboard
            InitKeyboard(_entryValidation);
        }
Example #3
0
        //Initialize UI Keyboard from VirtualKeyboard
        private VBox InitVirtualKeyboard(VirtualKeyBoard pVirtualKeyboard)
        {
            List <VirtualKey> currentKeyboardRow;
            VirtualKey        currentKey;     //Virtual Key
            KeyboardPadKey    keyboardPadKey; //UI GTK Key

            //Init Lists
            List <HBox> hboxKeyBoard = new List <HBox>();
            List <HBox> hboxNumPad   = new List <HBox>();

            //Init VBoxs to strore Rows
            _vboxKeyboardRows = new VBox(true, 0);
            _vboxNumPadRows   = new VBox(true, 0);

            //loop rows
            for (int i = 0; i < pVirtualKeyboard.KeyBoard.Count; i++)
            {
                //Get current VirtualKeyboard Row to Work
                currentKeyboardRow = pVirtualKeyboard.KeyBoard[i];

                //add new Hbox to hboxKeyBoard/hboxNumPad rows List
                hboxKeyBoard.Add(new HBox(false, 0));
                hboxNumPad.Add(new HBox(false, 0));

                //loop columns in a row
                for (int j = 0; j < currentKeyboardRow.Count; j++)
                {
                    //Debug
                    //_log.Debug(string.Format("InitVirtualKeyboard(): tmpKey{0}:{1}:{2}", i, j, currentKey.L1.Glyph));

                    currentKey = currentKeyboardRow[j];

                    //Create UI Key
                    keyboardPadKey          = new KeyboardPadKey(currentKey);
                    keyboardPadKey.Clicked += keyboardPadKey_Clicked;
                    //Assign its UI reference to VirtualKey, usefull to have access to UI in VirtualKeyboard.VirtualKey
                    currentKey.UIKey = keyboardPadKey;

                    //If is a IsNumPad L1 key add to IsNumPad
                    if (currentKey.L1.IsNumPad)
                    {
                        hboxNumPad[i].PackStart(keyboardPadKey, false, false, 0);
                    }
                    //Else Add to KeyBoard
                    else
                    {
                        hboxKeyBoard[i].PackStart(keyboardPadKey, false, false, 0);
                    };
                }
                //In the end add row to Vbox
                _vboxKeyboardRows.PackStart(hboxKeyBoard[i]);
                _vboxNumPadRows.PackStart(hboxNumPad[i]);
            }

            //Pack KeyBoard and NumberPad into hboxResultReyboard
            HBox hboxResultReyboard = new HBox(false, 0);

            hboxResultReyboard.Spacing = _spacing;
            hboxResultReyboard.PackStart(_vboxKeyboardRows, false, false, 0);
            hboxResultReyboard.PackStart(_vboxNumPadRows, false, false, 0);
            //Init _textEntry
            Pango.FontDescription fontDescriptiontextEntry = Pango.FontDescription.FromString(_fontKeyboardPadTextEntry);
            _textEntry = new EntryValidation();
            _textEntry.ModifyFont(fontDescriptiontextEntry);
            //Change Selected Text, when looses entry focus
            _textEntry.ModifyBase(StateType.Active, Utils.ColorToGdkColor(Color.Gray));
            //Final Pack KeyBoard + TextEntry
            VBox vboxResult = new VBox(false, _spacing);

            vboxResult.PackStart(_textEntry);
            vboxResult.PackStart(hboxResultReyboard);

            //Events
            this.KeyReleaseEvent += KeyBoardPad_KeyReleaseEvent;

            //Add Space arround Keyboards
            return(vboxResult);
        }
Example #4
0
        public MoneyPad(Window pSourceWindow, decimal pInitialValue = 0.0m)
        {
            //Settings
            string fontMoneyPadButtonKeys = GlobalFramework.Settings["fontMoneyPadButtonKeys"];
            string fontMoneyPadTextEntry  = GlobalFramework.Settings["fontMoneyPadTextEntry"];
            //ButtonLabels
            string moneyButtonL1Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL1Value);
            string moneyButtonL2Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL2Value);
            string moneyButtonL3Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL3Value);
            string moneyButtonL4Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL4Value);
            string moneyButtonL5Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonL5Value);
            string moneyButtonR1Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR1Value);
            string moneyButtonR2Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR2Value);
            string moneyButtonR3Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR3Value);
            string moneyButtonR4Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR4Value);
            string moneyButtonR5Label = FrameworkUtils.DecimalToStringCurrency(_decimalMoneyButtonR5Value);

            //Local Vars
            Color colorFont           = Color.White;
            Size  numberPadButtonSize = new Size(100, 80);
            Size  moneyButtonSize     = new Size(100, 64);

            //Delivery Entry
            string initialValue = (pInitialValue > 0) ? FrameworkUtils.DecimalToString(pInitialValue) : string.Empty;

            _entryDeliveryValue = new EntryValidation(pSourceWindow, KeyboardMode.None, SettingsApp.RegexDecimal, true)
            {
                Text = initialValue, Alignment = 0.5F
            };
            _entryDeliveryValue.ModifyFont(Pango.FontDescription.FromString(fontMoneyPadTextEntry));
            //Dialog Validated Equal to Entry, Its the Only Entry in Dialog
            _validated = _entryDeliveryValue.Validated;
            //Event
            _entryDeliveryValue.Changed += _entry_Changed;

            //NumberPad
            _numberPad          = new NumberPad("numberPad", Color.Transparent, fontMoneyPadButtonKeys, (byte)numberPadButtonSize.Width, (byte)numberPadButtonSize.Height);
            _numberPad.Clicked += _numberPad_Clicked;

            //MoneyButtons Left
            _buttonKeyMBL1 = new TouchButtonText("touchButtonKeyMBL1_Green", Color.Transparent, moneyButtonL1Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL2 = new TouchButtonText("touchButtonKeyMBL2_Green", Color.Transparent, moneyButtonL2Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL3 = new TouchButtonText("touchButtonKeyMBL3_Green", Color.Transparent, moneyButtonL3Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL4 = new TouchButtonText("touchButtonKeyMBL4_Green", Color.Transparent, moneyButtonL4Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBL5 = new TouchButtonText("touchButtonKeyMBL5_Green", Color.Transparent, moneyButtonL5Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            //MoneyButtons Right
            _buttonKeyMBR1 = new TouchButtonText("touchButtonKeyMBR1_Green", Color.Transparent, moneyButtonR1Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR2 = new TouchButtonText("touchButtonKeyMBR2_Green", Color.Transparent, moneyButtonR2Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR3 = new TouchButtonText("touchButtonKeyMBR3_Green", Color.Transparent, moneyButtonR3Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR4 = new TouchButtonText("touchButtonKeyMBR4_Green", Color.Transparent, moneyButtonR4Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            _buttonKeyMBR5 = new TouchButtonText("touchButtonKeyMBR5_Green", Color.Transparent, moneyButtonR5Label, fontMoneyPadButtonKeys, colorFont, (byte)moneyButtonSize.Width, (byte)moneyButtonSize.Height);
            //Events
            _buttonKeyMBL1.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL2.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL3.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL4.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBL5.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR1.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR2.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR3.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR4.Clicked += buttonKeyMB_Clicked;
            _buttonKeyMBR5.Clicked += buttonKeyMB_Clicked;

            VBox vboxMoneyButtonsLeft = new VBox(true, 0);

            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL1, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL2, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL3, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL4, true, true, 0);
            vboxMoneyButtonsLeft.PackStart(_buttonKeyMBL5, true, true, 0);

            VBox vboxMoneyButtonsRight = new VBox(true, 0);

            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR1, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR2, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR3, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR4, true, true, 0);
            vboxMoneyButtonsRight.PackStart(_buttonKeyMBR5, true, true, 0);

            HBox hboxInput = new HBox(false, 5);

            hboxInput.PackStart(vboxMoneyButtonsLeft);
            hboxInput.PackStart(_numberPad);
            hboxInput.PackStart(vboxMoneyButtonsRight);

            //Vbox
            VBox vboxNumberPad = new VBox(false, 0);

            vboxNumberPad.PackStart(_entryDeliveryValue, false, true, 5);
            vboxNumberPad.PackStart(hboxInput, true, true, 5);

            //Pack It
            this.Add(vboxNumberPad);
        }
Example #5
0
        public NumberPadPin(Window pSourceWindow, string pName, Color pButtonColor, string pFont, string pFontLabelStatus, Color pFontColor, Color pFontColorLabelStatus, byte pButtonWidth, byte pButtonHeight, bool pShowSystemButtons = false, bool pVisibleWindow = false, uint pRowSpacingLabelStatus = 20, uint pRowSpacingSystemButtons = 40, byte pPadding = 3)
        {
            _sourceWindow = pSourceWindow;
            this.Name     = pName;

            //Show or Hide System Buttons (Startup Visible, Pos Change User Invisible)
            uint tableRows = (pShowSystemButtons) ? (uint)5 : (uint)3;

            _eventbox = new EventBox()
            {
                VisibleWindow = pVisibleWindow
            };

            _table             = new Table(tableRows, 3, true);
            _table.Homogeneous = false;

            //Pin Entry
            _entryPin = new EntryValidation(pSourceWindow, KeyboardMode.None, SettingsApp.RegexLoginPin, true)
            {
                InvisibleChar = '*', Visibility = false
            };
            _entryPin.ModifyFont(Pango.FontDescription.FromString(pFont));
            _entryPin.Alignment = 0.5F;

            //ResetPassword
            string numberPadPinButtonPasswordResetImageFileName = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Other\pinpad_password_reset.png");

            _buttonKeyResetPassword = new TouchButtonIcon("touchButtonKeyPasswordReset", System.Drawing.Color.Transparent, numberPadPinButtonPasswordResetImageFileName, new Size(20, 20), 25, 25)
            {
                Sensitive = false
            };

            //Start Validated
            _entryPin.Validate();
            //Event
            _entryPin.Changed         += _entryPin_Changed;
            _entryPin.KeyReleaseEvent += _entryPin_KeyReleaseEvent;

            //Label Status
            _labelStatus = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "pos_pinpad_message_type_password"));
            _labelStatus.ModifyFont(Pango.FontDescription.FromString(pFontLabelStatus));
            _labelStatus.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(pFontColorLabelStatus));
            _labelStatus.SetAlignment(0.5F, 0.5f);

            //Initialize Buttons
            TouchButtonText buttonKey1  = new TouchButtonText("touchButtonKey1", pButtonColor, "1", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey2  = new TouchButtonText("touchButtonKey2", pButtonColor, "2", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey3  = new TouchButtonText("touchButtonKey3", pButtonColor, "3", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey4  = new TouchButtonText("touchButtonKey4", pButtonColor, "4", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey5  = new TouchButtonText("touchButtonKey5", pButtonColor, "5", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey6  = new TouchButtonText("touchButtonKey6", pButtonColor, "6", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey7  = new TouchButtonText("touchButtonKey7", pButtonColor, "7", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey8  = new TouchButtonText("touchButtonKey8", pButtonColor, "8", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey9  = new TouchButtonText("touchButtonKey9", pButtonColor, "9", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKey0  = new TouchButtonText("touchButtonKey0", pButtonColor, "0", pFont, pFontColor, pButtonWidth, pButtonHeight);
            TouchButtonText buttonKeyCE = new TouchButtonText("touchButtonKeyCE_Red", pButtonColor, "CE", pFont, pFontColor, pButtonWidth, pButtonHeight);

            //Shared Button,can be OK or Quit based on ShowSystemButtons
            TouchButtonText _buttonQuitOrOk;

            //Outside Reference Buttons (Public)
            _buttonKeyOK = new TouchButtonText("touchButtonKeyOK_Green", pButtonColor, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "widget_pospinpad_ok"), pFont, pFontColor, pButtonWidth, pButtonHeight)
            {
                Sensitive = false
            };
            //_buttonKeyResetPassword = new TouchButtonText("touchButtonKeyReset_Red", pButtonColor, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "widget_pospinpad_change_password, pFont, pFontColor, pButtonWidth, pButtonHeight) { Sensitive = false };

            if (pShowSystemButtons)
            {
                _buttonKeyFrontOffice = new TouchButtonText("touchButtonKeyFrontOffice_DarkGrey", pButtonColor, "FO", pFont, pFontColor, pButtonWidth, pButtonHeight)
                {
                    Sensitive = false, Visible = false
                };
                _buttonKeyQuit       = new TouchButtonText("touchButtonKeyQuit_DarkGrey", pButtonColor, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_quit_title"), pFont, pFontColor, pButtonWidth, pButtonHeight);
                _buttonKeyBackOffice = new TouchButtonText("touchButtonKeyBackOffice_DarkGrey", pButtonColor, "BO", pFont, pFontColor, pButtonWidth, pButtonHeight)
                {
                    Sensitive = false, Visible = false
                };
                _buttonQuitOrOk = _buttonKeyQuit;
            }
            else
            {
                _buttonQuitOrOk = _buttonKeyOK;
            }

            //_buttonKeyOK.Style.SetBgPixmap(StateType.Active, Utils.FileToPixmap("Assets/Themes/Default/Backgrounds/Windows/test.png"));
            //_buttonKeyOK.Style = Utils.GetThemeStyleBackground(@"Backgrounds/Windows/test.png");

            //Events
            buttonKey1.Clicked  += buttonKey_Clicked;
            buttonKey2.Clicked  += buttonKey_Clicked;
            buttonKey3.Clicked  += buttonKey_Clicked;
            buttonKey4.Clicked  += buttonKey_Clicked;
            buttonKey5.Clicked  += buttonKey_Clicked;
            buttonKey6.Clicked  += buttonKey_Clicked;
            buttonKey7.Clicked  += buttonKey_Clicked;
            buttonKey8.Clicked  += buttonKey_Clicked;
            buttonKey9.Clicked  += buttonKey_Clicked;
            buttonKey0.Clicked  += buttonKey_Clicked;
            buttonKeyCE.Clicked += buttonKeyCE_Clicked;

            //Prepare Table

            //row0
            int entryPinTablePos = (pShowSystemButtons) ? 2 : 3;

            //Without ResetPassword Button
            if (!pShowSystemButtons)
            {
                _table.Attach(_entryPin, 0, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            }
            //With ResetPassword Button
            else
            {
                _table.Attach(_entryPin, 0, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
                _table.Attach(_buttonKeyResetPassword, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            }
            //row1
            _table.Attach(buttonKey7, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(buttonKey8, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(buttonKey9, 2, 3, 1, 2, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            //row2
            _table.Attach(buttonKey4, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(buttonKey5, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(buttonKey6, 2, 3, 2, 3, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            //row3
            _table.Attach(buttonKey1, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(buttonKey2, 1, 2, 3, 4, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(buttonKey3, 2, 3, 3, 4, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            //row4
            _table.Attach(buttonKeyCE, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(buttonKey0, 1, 2, 4, 5, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.Attach(_buttonQuitOrOk, 2, 3, 4, 5, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            //Row5
            _table.Attach(_labelStatus, 0, 3, 5, 6, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
            _table.SetRowSpacing(4, pRowSpacingLabelStatus);
            //row6
            if (pShowSystemButtons)
            {
                //_table.Attach(_buttonKeyFrontOffice, 0, 1, 5, 6, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
                //_table.Attach(_buttonKeyOK, 0, 3, 7, 8, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
                //_table.Attach(_buttonKeyBackOffice, 2, 3, 5, 6, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
                _table.Attach(_buttonKeyOK, 0, 3, 7, 8, AttachOptions.Fill, AttachOptions.Fill, pPadding, pPadding);
                //space between Status Message and POS Keys
                _table.SetRowSpacing(5, pRowSpacingSystemButtons);
            }

            _eventbox.Add(_table);
            this.Add(_eventbox);
        }