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);
        }
 private void SubmitCommandExecute(object obj)
 {
     try
     {
         string password = (obj as PasswordBox).Password;
         if (UserName.Equals("Zaposleni") && password.Equals("Zaposleni"))
         {
             ViewEmployeeView employeeView = new ViewEmployeeView();
             view.Close();
             employeeView.Show();
             return;
         }
         else if (EntryValidation.ValidateJmbg(UserName) && password.Equals("Gost"))
         {
             ViewGuestView guestView = new ViewGuestView();
             view.Close();
             guestView.Show();
             return;
         }
         else
         {
             MessageBox.Show("Wrong usename or password");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 private void ConfirmCommandExecute()
 {
     try
     {
         if (EntryValidation.IsOnlyLetters(user.FirstName) == false)
         {
             MessageBox.Show("First name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.IsOnlyLetters(user.LastName) == false)
         {
             MessageBox.Show("Last name can only contain letters. Please try again", "Invalid input");
             return;
         }
         databaseService.AddUser(user);
         UserView userView = new UserView(user);
         MessageBox.Show("User registered successfully.", "Info");
         firstTimeAccessView.Close();
         userView.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
示例#4
0
        private void btnAddTask_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!ValidateTask())
                {
                    return;
                }

                Entities.Task t = new Entities.Task
                {
                    LawyerID     = ((Lawyer)cbLawyerT.SelectedItem).LawyerID,
                    SubmatterID  = ((Submatter)cbSubmatterT.SelectedItem).SubmatterID,
                    Date         = dpDateT.SelectedDate.Value,
                    BillableTime = int.Parse(tbBillableMins.Text)
                };

                if (!EntryValidation.IsEmpty(tbDescriptionT.Text))
                {
                    t.Description = tbDescriptionT.Text;
                }

                t.Add();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
 public void ValidateEntryLength_Failing()
 {
     using (ServiceMock mocks = new ServiceMock()) {
         mocks.MockConfigService(3);
         EntryValidation validator = new EntryValidation();
         Assert.IsFalse(validator.ValidateEntryLength("bacon"));
     }
 }
示例#6
0
        public void ValidatePasswordTest(string name)
        {
            EntryValidation tool    = new EntryValidation();
            string          pattern = @"^(?=.*[A-Z])(?=.*[0-9])(?=.*[^0-9a-zA-Z])(?!.*[^0-9a-zA-Z].*[^0-9a-zA-Z]).{8,}$";
            bool            actual  = tool.IsValid(pattern, name);

            Assert.AreEqual(true, actual);
        }
示例#7
0
        public void ValidateMobileNumberTest(string name)
        {
            EntryValidation validEntry = new EntryValidation();
            string          pattern    = @"^[0-9]{2}[ ][0-9]{10}$";
            bool            actual     = validEntry.IsValid(pattern, name);

            Assert.AreEqual(true, actual);
        }
示例#8
0
        public void ValidateEmailTest(string name)
        {
            EntryValidation tool    = new EntryValidation();
            string          pattern = @"^[a-zA-Z0-9]+([.+_-][a-zA-Z0-9]+)*@[a-zA-Z0-9]+([.][a-zA-Z]{3})+([.][a-zA-Z]{2})?$";
            bool            actual  = tool.IsValid(pattern, name);

            Assert.AreEqual(true, actual);
        }
 public void ValidateEntryLength_Passing()
 {
     using (ServiceMock mocks = new ServiceMock()) {
         mocks.MockConfigService(3);
         EntryValidation validator = new EntryValidation();
         Assert.IsTrue(validator.ValidateEntryLength("moo"));
     }
 }
 public void ValidateEntryNumericAndInMinMaxBounds_ValueJustRight()
 {
     using (ServiceMock mocks = new ServiceMock()) {
         mocks.MockConfigService(3, 4, 4);
         EntryValidation validator = new EntryValidation();
         Assert.IsTrue(validator.ValidateEntryNumericAndInMinMaxBounds("4"));
     }
 }
 public void ValidateEntryNumericAndInMinMaxBounds_AboveMaxValue()
 {
     using (ServiceMock mocks = new ServiceMock()) {
         mocks.MockConfigService(3, 4, 8);
         EntryValidation validator = new EntryValidation();
         Assert.IsFalse(validator.ValidateEntryNumericAndInMinMaxBounds("9"));
     }
 }
 public void ValidateEntryNumericAndInMinMaxBounds_NonNumeric()
 {
     using (ServiceMock mocks = new ServiceMock()) {
         mocks.MockConfigService(3, 1, 8);
         EntryValidation validator = new EntryValidation();
         Assert.IsFalse(validator.ValidateEntryNumericAndInMinMaxBounds("bacon is the best"));
     }
 }
示例#13
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Events

        void _entryPin_Changed(object sender, EventArgs e)
        {
            EntryValidation entry = (EntryValidation)sender;

            ClearEntryPinStatusMessage();
            _buttonKeyOK.Sensitive            = entry.Validated;
            _buttonKeyResetPassword.Sensitive = (entry.Validated && _mode == NumberPadPinMode.Password);
        }
示例#14
0
        private void SaveExecute()
        {
            try
            {
                if (EntryValidation.ValidateName(Worker.FirstName) == false)
                {
                    MessageBox.Show("First Name can only contain letters. Please try again", "Invalid input");
                    return;
                }
                if (EntryValidation.ValidateName(Worker.LastName) == false)
                {
                    MessageBox.Show("Last Name can only contain letters. Please try again", "Invalid input");
                    return;
                }
                if (EntryValidation.ValidateDate(Worker.DateOfBirth) == false)
                {
                    MessageBox.Show("Person Must be at least 16 years of age. Please try again", "Invalid input");
                    return;
                }
                if (EntryValidation.ValidatePersonalIDNumber(Worker.PersonalIDNumber) == false)
                {
                    MessageBox.Show("Personal ID nubmer you entered is not valid. Please try again", "Invalid input");
                    return;
                }
                if (EntryValidation.ValidateJmbg(Worker.JMBG) == false)
                {
                    MessageBox.Show("JMBG you entered is not valid. Please try again", "Invalid input");
                    return;
                }
                if (EntryValidation.ValidatePhone(Worker.PhoneNumber) == false)
                {
                    MessageBox.Show("Phone number you entered is not in correct format. Please try again", "Invalid input");
                    return;
                }
                Worker.GenderID = Gender.GenderID;
                Worker.SectorID = Sector.SectorID;
                if (Manager != null)
                {
                    Worker.ManagerID = Manager.WorkerID;
                }

                Worker.LocationID = Location.LocationID;
                _dbService.AddWorker(Worker);
                IsUpdateWorker = true;
                string logMessage = string.Format("Worker {0} {1} - JMBG:{2}, was added to database.", _worker.FirstName,
                                                  _worker.LastName, _worker.JMBG);
                actionEventObject.OnActionPerformed(logMessage);
                MessageBox.Show("New Worker Added Successfully!", "Info");
                _addWorker.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#15
0
        //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
        //Event Handlers

        void _entry_Changed(object sender, EventArgs e)
        {
            EntryValidation entry = (EntryValidation)sender;

            _validated     = entry.Validated;
            _deliveryValue = FrameworkUtils.StringToDecimal(_entryDeliveryValue.Text);
            if (EntryChanged != null)
            {
                EntryChanged(sender, e);
            }
        }
 private void btnOk_Click(object sender, EventArgs e)
 {
     // If there's a validation function, check and only set if valid, otherwise assume all text is valid.
     if (EntryValidation != null)
     {
         if (!EntryValidation.Invoke(tbInput.Text))                      // Validation fails.
         {
             MessageBox.Show("Invalid Entry!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     Hide();
 }
示例#17
0
        public void TestFirstName()
        {
            //Arrange
            EntryValidation tool    = new EntryValidation();
            string          pattern = @"^[A-Z]{1}[a-zA-Z]{2,}$";

            //Act
            bool actual   = tool.IsValid(pattern, "Akash");
            bool expected = true;

            //Assert
            Assert.AreEqual(expected, actual);
        }
示例#18
0
 private void AddEmployeeCommandExecute(object obj)
 {
     try
     {
         if (EntryValidation.ValidateForLetters(employee.FullName) == false)
         {
             MessageBox.Show("Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateDate(employee.DateOfBirth) == false)
         {
             MessageBox.Show("Person must be at least 16 years old. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateEmail(employee.Email) == false)
         {
             MessageBox.Show("Invalid Email format. Please try again", "Invalid input");
             return;
         }
         if (employee.UserName.Length < 8)
         {
             MessageBox.Show("Username must be at least 8 characters", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateNumber(employee.FloorNumber.ToString()) == false)
         {
             MessageBox.Show("Floor must be a number", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateForLetters(employee.Citizenship) == false)
         {
             MessageBox.Show("Citizenship can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (IsManagerOnGivenFloor(employee.FloorNumber) == false)
         {
             MessageBox.Show("No manager present on a given floor, please choose another floor number.", "Invalid input");
             return;
         }
         string password        = (obj as PasswordBox).Password;
         string encryptPassword = EncryptionHelper.Encrypt(password);
         employee.Password = encryptPassword;
         dataBaseService.AddEmployee(employee);
         MessageBox.Show("New employee registered successfully!", "Info");
         employeeView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
示例#19
0
 private void AddManagerCommandExecute(object obj)
 {
     try
     {
         if (EntryValidation.ValidateForLetters(manager.FullName) == false)
         {
             MessageBox.Show("Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateDate(manager.DateOfBirth) == false)
         {
             MessageBox.Show("Person must be at least 16 years old. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateEmail(manager.Email) == false)
         {
             MessageBox.Show("Invalid Email format. Please try again", "Invalid input");
             return;
         }
         if (manager.UserName.Length < 8)
         {
             MessageBox.Show("Username must be at least 8 characters", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateNumber(manager.FloorNumber.ToString()) == false)
         {
             MessageBox.Show("Floor must be a number", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateNumber(manager.WorkExperience.ToString()) == false)
         {
             MessageBox.Show("Work experience must be a number", "Invalid input");
             return;
         }
         string password        = (obj as PasswordBox).Password;
         string encryptPassword = EncryptionHelper.Encrypt(password);
         manager.Password = encryptPassword;
         dataBaseService.AddManager(manager);
         MessageBox.Show("New manager registered successfully!", "Info");
         managerView.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
示例#20
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);
        }
示例#21
0
 private static bool Validate(Company Company)
 {
     try
     {
         EntryValidation v = new EntryValidation();
         v.AddIfEmpty(Company.Name, "Name");
         if (v.HasErrors())
         {
             v.PrintErrors();
             return(false);
         }
     }
     catch
     {
         throw;
     }
     return(true);
 }
示例#22
0
 private static bool Validate(Task Task)
 {
     try
     {
         EntryValidation v = new EntryValidation();
         //v.AddIfEmpty(Task.BillableTime, "Billable time");
         if (v.HasErrors())
         {
             v.PrintErrors();
             return(false);
         }
     }
     catch
     {
         throw;
     }
     return(true);
 }
示例#23
0
 private void ListViewSearch(string Text, ListView ListViewToSearch, RefreshFunction RefreshFunction)
 {
     if (EntryValidation.IsEmpty(Text))
     {
         for (int i = ListViewToSearch.Items.Count - 1; i >= 0; i--)
         {
             var item = ListViewToSearch.Items.GetItemAt(i);
             if (!item.ToString().ToLower().Contains(Text.ToLower()))
             {
                 ListViewToSearch.Items.Remove(item);
             }
         }
     }
     else
     {
         RefreshFunction();
     }
 }
示例#24
0
 private void EditCommandExecute()
 {
     try
     {
         if (EntryValidation.ValidateProductName(WarehouseItem.ProductName) == false)
         {
             MessageBox.Show("Product name can only contain letters and numbers. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateProductNumber(WarehouseItem.ProductNumber) == false)
         {
             MessageBox.Show("Product number can only contain numbers. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateAmount((int)WarehouseItem.Amount) == false)
         {
             MessageBox.Show("Amount must be greated than 0 and less or equat to 100. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidatePriceFormat(WarehouseItem.Price) == false)
         {
             MessageBox.Show("Price can contain only decimal numbers (numbers, comma and dot is allowed). Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidatePriceAmount(WarehouseItem.Price) == false)
         {
             MessageBox.Show("Price must be a positive number. Please try again", "Invalid input");
             return;
         }
         dataBaseService.EditWarehouseItem(WarehouseItem);
         IsUpdateWarehouseItem = true;
         string logMessage = string.Format("Warehouse Item: {0}, Item number: {1}, Item amount: {2}, Item price: {3} was edited to new Item Name:{4}," +
                                           " Item Number: {5}, Item Amount: {6}, Item Price: {7}.", ProductNameBeforeEdit, ProductNumberBeforeEdit, AmountBeforeEdit, PriceBeforeEdit, WarehouseItem.ProductName,
                                           WarehouseItem.ProductNumber, WarehouseItem.Amount, WarehouseItem.Price);
         actionEventObject.OnActionPerformed(logMessage);
         MessageBox.Show("New Warehouse Item Edited Successfully!", "Info");
         editItem.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        public XPOEntryBoxSelectRecordValidation(Window pSourceWindow, string pLabelText, string pFieldDisplayValue, string pFieldValidateValue, T1 pCurrentValue, CriteriaOperator pCriteriaOperator, KeyboardMode pKeyboardMode, string pRule, bool pRequired)
            : base(pSourceWindow, pLabelText, pFieldDisplayValue, pFieldValidateValue, pCurrentValue, pCriteriaOperator)
        {
            //Entry: Required to Assign BaseClass _label Reference to EntryValidation.Label :)
            _entryValidation = new EntryValidation(pSourceWindow, pKeyboardMode, pRule, pRequired)
            {
                Label = _label
            };

            //Start Validated
            _entryValidation.Validate(GetValue(pFieldValidateValue));

            //Always validate when we Change Values
            _entryValidation.Changed += delegate
            {
                _entryValidation.Validate(GetValue(pFieldValidateValue));
            };

            InitEntry(_entryValidation);
            //Init Keyboard
            InitKeyboard(_entryValidation);
        }
 private void AddPatientCommandExecute(object obj)
 {
     try
     {
         if (EntryValidation.ValidateName(Patient.FirstName) == false)
         {
             MessageBox.Show("First Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateName(Patient.LastName) == false)
         {
             MessageBox.Show("Last Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateJmbg(Patient.JMBG) == false)
         {
             MessageBox.Show("JMBG you entered is not valid. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateMedicalInsuranceNumber(Patient.MedicalInsuranceNumber) == false)
         {
             MessageBox.Show("Medical insurance number entered is not valid, must contain exactly 11 numbers. Please try again", "Invalid input");
             return;
         }
         string password        = (obj as PasswordBox).Password;
         string encryptPassword = EncryptionHelper.Encrypt(password);
         patient.Password = encryptPassword;
         dataBaseService.AddPatient(patient);
         MessageBox.Show("New patient registered successfully!", "Info");
         addPatient.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
 private void AddDoctorCommandExecute(object obj)
 {
     try
     {
         if (EntryValidation.ValidateName(Doctor.FirstName) == false)
         {
             MessageBox.Show("First Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateName(Doctor.LastName) == false)
         {
             MessageBox.Show("Last Name can only contain letters. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateJmbg(Doctor.JMBG) == false)
         {
             MessageBox.Show("JMBG you entered is not valid. Please try again", "Invalid input");
             return;
         }
         if (EntryValidation.ValidateBankAccountNumber(Doctor.BankAccountNumber) == false)
         {
             MessageBox.Show("Bank account nubmer you entered is not valid, must contain exactly 18 numbers. Please try again", "Invalid input");
             return;
         }
         string password        = (obj as PasswordBox).Password;
         string encryptPassword = EncryptionHelper.Encrypt(password);
         doctor.Password = encryptPassword;
         dataBaseService.AddDoctor(doctor);
         MessageBox.Show("New doctor registered successfully!", "Info");
         addDoctor.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
示例#28
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);
        }
示例#29
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);
        }
示例#30
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);
        }