public virtual void TbOnTextChanging(object sender, TextBoxTextChangingEventArgs e)
        {

            if (AssociatedObjectAsTextBox == null)
            {
                return;
            }

            try
            {

                AssociatedObjectAsTextBox.TextChanging -= TbOnTextChanging;

                if (IsValidValue())
                {
                    CurrentTextValue = AssociatedObjectAsTextBox.Text;
                }

                AssociatedObjectAsTextBox.Text = CurrentTextValue;

                AssociatedObjectAsTextBox.SelectionStart = AssociatedObjectAsTextBox.Text.Length;

            }
            catch (Exception)
            {
            }
            finally
            {
                AssociatedObjectAsTextBox.TextChanging += TbOnTextChanging;
            }



        }
Ejemplo n.º 2
0
 private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     double dtemp;
     if (!double.TryParse(sender.Text, out dtemp) && sender.Text != "")
     {
         sender.Text = sender.Text.Remove(--sender.SelectionStart, 1);
     }
 }
 private void PlayerScoreTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     if ((PlayerOneScoreTextBox.Text.Count() > 0) &&
         (PlayerTwoScoreTextBox.Text.Count() > 0) &&
         (PlayerThreeScoreTextBox.Text.Count() > 0) &&
         (PlayerFourScoreTextBox.Text.Count() > 0))
         scoreRoundButton.Visibility = Visibility.Visible;
     else
         scoreRoundButton.Visibility = Visibility.Collapsed;
 }
Ejemplo n.º 4
0
 private void TicketNumberTbx_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     for (int i = 0; i < sender.Text.Length; ++i)
     {
         if (!char.IsNumber(sender.Text[i]))
         {
             sender.Text = sender.Text.Remove(i, 1);
             --i;
         }
     }
 }
Ejemplo n.º 5
0
        private void IntBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            long dtemp;
            if (sender.Text.Length > 62)
            {
                sender.Text = sender.Text.Remove(--sender.SelectionStart, 1);
                return;
            }
            if ((sender.DataContext as ProgramViewModel).Parameter == 3)
            {
                foreach (var c in LongExtension.HexSet)
                {
                    if (sender.Text == "" || c == sender.Text[sender.SelectionStart - 1])
                    {
                        return;
                    }

                }
            }
            else if ((sender.DataContext as ProgramViewModel).Parameter == 2)
            {
                if (!long.TryParse(sender.Text, out dtemp) && sender.Text != "")
                {
                    sender.Text = sender.Text.Remove(--sender.SelectionStart, 1);
                }
                return;
            }
            else if ((sender.DataContext as ProgramViewModel).Parameter == 1)
            {
                if (sender.Text == "" || sender.Text[sender.SelectionStart - 1] >= '0' && sender.Text[sender.SelectionStart - 1] < '8')
                {
                    return;
                }
            }
            else if ((sender.DataContext as ProgramViewModel).Parameter == 0)
            {
                if (sender.Text == "" || sender.Text[sender.SelectionStart - 1] >= '0' && sender.Text[sender.SelectionStart - 1] < '2')
                {
                    return;
                }

            }
            if (sender.Text != "")
                sender.Text = sender.Text.Remove(--sender.SelectionStart, 1);
        }
Ejemplo n.º 6
0
 private void textEventsTB_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     AppendTextEventsLogging("TextChanging:" + textEventsTB.Text);
 }
Ejemplo n.º 7
0
        private void OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            var textBox = (ReactTextBox)sender;

            textBox.IncrementEventCount();
        }
 private void salevalue2_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     sender.Text           = new String(sender.Text.Where(x => char.IsDigit(x) || x == '.').ToArray());
     sender.SelectionStart = sender.Text.Length;
 }
 private void delaysTextBoxTextChangingHandler(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     sender.Text = sender.Text.StripNonDigitOrWhiteSpace();
     viewModel.Options.Delays = sender.Text;
 }
Ejemplo n.º 10
0
 private void markkaTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     changing = true;
 }
Ejemplo n.º 11
0
 private void TextBox_TextChanging( TextBox sender, TextBoxTextChangingEventArgs args )
 {
     TOC.SearchTerm = sender.Text.Trim();
 }
Ejemplo n.º 12
0
 private void Text_lockscreentag_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     wallpaperTaskSettings.LSTag = sender.Text;
 }
Ejemplo n.º 13
0
        private void ScoreATextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            try {
                ScoreBTextBox.TextChanging -= ScoreBTextBox_TextChanging;

                if (ScoreATextBox.Text.Length != 0)
                {
                    if (ScoreATextBox.Text == "-")
                    {
                        ScoreB             = 0;
                        ScoreBTextBox.Text = "0";
                        ScoreATextBox.Text.TrimStart('-');
                        string NegativeScore = ScoreATextBox.Text;
                        NegativeScore += "0";
                        ScoreA         = Convert.ToInt32(NegativeScore);
                        ScoreA         = int.Parse(NegativeScore);
                        ScoreA         = -1 * ScoreB;
                    }
                    else
                    {
                        ScoreB             = 0;
                        ScoreBTextBox.Text = "0";
                        ScoreA             = Convert.ToInt32(ScoreATextBox.Text);
                        ScoreA             = int.Parse(ScoreATextBox.Text);
                        if ((ScoreA % 5) == 0 && ScoreA != 0)
                        {
                            if ((ScoreA > 100 && ScoreA <= 200) || (ScoreA >= -200 && ScoreA < -100))
                            {
                                ScoreB             = 200 - ScoreA;
                                ScoreBTextBox.Text = ScoreB.ToString();
                            }
                            else if ((ScoreA > 200 && ScoreA <= 300) || (ScoreA >= -300 && ScoreA < -200))
                            {
                                ScoreB             = 300 - ScoreA;
                                ScoreBTextBox.Text = ScoreB.ToString();
                            }
                            else if (ScoreA == 400)
                            {
                                ScoreB             = 0;
                                ScoreBTextBox.Text = ScoreB.ToString();
                            }
                            else if (((ScoreA > 0) && (ScoreA <= 100)))
                            {
                                ScoreB             = 100 - ScoreA;
                                ScoreBTextBox.Text = ScoreB.ToString();
                            }
                            else if ((ScoreA >= -100) && (ScoreA < 0))
                            {
                                ScoreB             = -1 * ScoreA;
                                ScoreBTextBox.Text = ScoreB.ToString();
                            }
                        }
                    }
                }
            }
            catch
            {
                //ScoreATextBox.Text.TrimEnd('.');
                //ScoreATextBox.Text.TrimEnd(',');
                ScoreATextBox.Text = String.Empty;
            }
        }
Ejemplo n.º 14
0
 private void TextBox_OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     Debug.WriteLine("...");
 }
        private void inputBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {//char by char
            int    position     = inputBox.SelectionStart;
            string input        = inputBox.Text;
            string inputReplace = input;

            while (input != "")
            {
                if (inputType1.SelectedIndex == 1)                          //decimal mask
                {
                    if (input.Length == 1)                                  //if there is only 1 char in inputReplace
                    {
                        if (!input.Any(char.IsDigit))                       //is it not a digit
                        {
                            inputReplace = inputReplace.Replace(input, ""); //replace it with nothing

                            inputBox.Text           = inputReplace;         //set the output
                            inputBox.SelectionStart = position - 1;         //set the position
                            break;
                        }
                        input = "";
                        break;
                    }
                    if (!input.Substring(0, 1).Any(char.IsDigit))                                  // if its not a digit
                    {
                        inputReplace            = inputReplace.Replace(input.Substring(0, 1), ""); //replace the bad char with nothing
                        inputBox.Text           = inputReplace;
                        inputBox.SelectionStart = position - 1;
                    }
                    if (input.Length != 1)
                    {
                        input = input.Substring(1, input.Length - 1);//removes first char to check the next***
                    }
                }
                else if (inputType1.SelectedIndex == 0)
                {                                                           //binary mask
                    if (input.Length == 1)                                  //if there is only 1 char in inputReplace
                    {
                        if (input != "1" && input != "0")                   //is it not a 1 or 0
                        {
                            inputReplace = inputReplace.Replace(input, ""); //replace it with nothing

                            inputBox.Text           = inputReplace;         //set the output
                            inputBox.SelectionStart = position - 1;         //set the position
                            break;
                        }
                        input = "";
                        break;
                    }
                    if (input.Substring(0, 1) != "1" && input.Substring(0, 1) != "0")              // if its not a 1 or 0
                    {
                        inputReplace            = inputReplace.Replace(input.Substring(0, 1), ""); //replace the bad char with nothing
                        inputBox.Text           = inputReplace;
                        inputBox.SelectionStart = position - 1;
                    }
                    if (input.Length != 1)
                    {
                        input = input.Substring(1, input.Length - 1);//removes first char to check the next***
                    }
                }
                else if (inputType1.SelectedIndex == 3)
                {                                                                                                                                         //octal mask
                    if (input.Length == 1)                                                                                                                //if there is only 1 char in inputReplace
                    {
                        if (input != "1" && input != "0" && input != "2" && input != "3" && input != "4" && input != "5" && input != "6" && input != "7") //is it not a 1 or 0
                        {
                            inputReplace = inputReplace.Replace(input, "");                                                                               //replace it with nothing

                            inputBox.Text           = inputReplace;                                                                                       //set the output
                            inputBox.SelectionStart = position - 1;                                                                                       //set the position
                            break;
                        }
                        input = "";
                        break;
                    }
                    if (input.Substring(0, 1) != "1" && input.Substring(0, 1) != "0" && input.Substring(0, 1) != "2" && input.Substring(0, 1) != "3" && input.Substring(0, 1) != "4" && input.Substring(0, 1) != "5" && input.Substring(0, 1) != "6" && input.Substring(0, 1) != "7") // if its not a 1 or 0
                    {
                        inputReplace            = inputReplace.Replace(input.Substring(0, 1), "");                                                                                                                                                                                    //replace the bad char with nothing
                        inputBox.Text           = inputReplace;
                        inputBox.SelectionStart = position - 1;
                    }
                    if (input.Length != 1)
                    {
                        input = input.Substring(1, input.Length - 1);//removes first char to check the next***
                    }
                }
                else if (inputType1.SelectedIndex == 2)
                {//Hex mask
                    input        = input.ToUpper();
                    inputReplace = input.ToUpper();


                    if (input.Length == 1)                                                                                                            //if there is only 1 char in inputReplace
                    {
                        if (input != "A" && input != "B" && input != "C" && input != "D" && input != "E" && input != "F" && !input.Any(char.IsDigit)) // if its not num or ABCDEF
                        {
                            inputReplace = inputReplace.Replace(input, "");                                                                           //replace it with nothing

                            inputBox.Text           = inputReplace;                                                                                   //set the output
                            inputBox.SelectionStart = position - 1;                                                                                   //set the position
                            break;
                        }
                        input = "";
                        break;
                    }
                    if (input.Substring(0, 1) != "A" && input.Substring(0, 1) != "B" && input.Substring(0, 1) != "C" && input.Substring(0, 1) != "D" && input.Substring(0, 1) != "E" && input.Substring(0, 1) != "F" && !input.Substring(0, 1).Any(char.IsDigit)) // if its not num or ABCDEF
                    {
                        inputReplace            = inputReplace.Replace(input.Substring(0, 1), "");                                                                                                                                                                //replace the bad char with nothing
                        inputBox.Text           = inputReplace;
                        inputBox.SelectionStart = position - 1;
                    }
                    if (input.Length != 1)
                    {
                        input = input.Substring(1, input.Length - 1);//removes first char to check the next***
                    }
                }
            }
        }
Ejemplo n.º 16
0
 private void player_name(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     NewName = nameplayer.Text;
 }
Ejemplo n.º 17
0
 private void TextBox_TextChanging( TextBox sender, TextBoxTextChangingEventArgs args )
 {
     FileListContext.SearchTerm = sender.Text.Trim();
 }
Ejemplo n.º 18
0
        private void ScoreBTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            try {
                ScoreATextBox.TextChanging -= ScoreATextBox_TextChanging;

                if (ScoreBTextBox.Text.Length != 0)
                {
                    if (ScoreBTextBox.Text == "-")
                    {
                        ScoreA = 0;
                        ScoreATextBox.Text = "0";
                        ScoreBTextBox.Text.TrimStart('-');
                        string NegativeScore = ScoreBTextBox.Text;
                        NegativeScore += "0";
                        ScoreB = Convert.ToInt32(NegativeScore);
                        ScoreB = int.Parse(NegativeScore);
                        ScoreB = -1 * ScoreA;
                    }
                    else
                    {
                        ScoreA = 0;
                        ScoreATextBox.Text = "0";
                        ScoreB = Convert.ToInt32(ScoreBTextBox.Text);
                        ScoreB = int.Parse(ScoreBTextBox.Text);
                        if ((ScoreB % 5) == 0 && ScoreB != 0)
                        {
                            if ((ScoreB > 100 && ScoreB <= 200) || (ScoreB >= -200 && ScoreB < -100))
                            {
                                ScoreA = 200 - ScoreB;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }
                            else if ((ScoreB > 200 && ScoreB <= 300) || (ScoreB >= -300 && ScoreB < -200))
                            {
                                ScoreA = 300 - ScoreB;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }
                            else if (ScoreB == 400)
                            {
                                ScoreA = 0;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }
                            else if (((ScoreB > 0) && (ScoreB <= 100)))
                            {
                                ScoreA = 100 - ScoreB;
                                ScoreBTextBox.Text = ScoreB.ToString();
                            }
                            else if ((ScoreB >= -100) && (ScoreB < 0))
                            {
                                ScoreA = -1 * ScoreB;
                                ScoreATextBox.Text = ScoreA.ToString();
                            }

                        }
                    }
                }
            }
            catch
            {
                ScoreBTextBox.Text = String.Empty;
            }
        }
Ejemplo n.º 19
0
 /// <summary>
 ///     Обработчик изменения адреса сервера
 /// </summary>
 private void IPBox_OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     ConfigManager.Config.IP = IPBox.Text;
 }
Ejemplo n.º 20
0
        private void OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs w)
        {
            Started();

            if (ignoreOnPhoneChange)
            {
                return;
            }

            int    start      = SelectionStart;
            String phoneChars = "0123456789";
            String str        = Text.ToString();

            if (characterAction == 3)
            {
                str = str.Substring(0, actionPosition) + str.Substring(actionPosition + 1);
                start--;
            }
            StringBuilder builder = new StringBuilder(str.Length);

            for (int a = 0; a < str.Length; a++)
            {
                String ch = str.Substring(a, 1);
                if (phoneChars.Contains(ch))
                {
                    builder.Append(ch);
                }
            }
            ignoreOnPhoneChange = true;
            String hint = PlaceholderText;

            if (hint != null)
            {
                for (int a = 0; a < builder.Length; a++)
                {
                    if (a < hint.Length)
                    {
                        if (hint[a] == ' ')
                        {
                            builder.Insert(a, ' ');
                            a++;
                            if (start == a && characterAction != 2 && characterAction != 3)
                            {
                                start++;
                            }
                        }
                    }
                    else
                    {
                        builder.Insert(a, ' ');
                        if (start == a + 1 && characterAction != 2 && characterAction != 3)
                        {
                            start++;
                        }
                        break;
                    }
                }
            }
            Text = builder.ToString();
            if (start >= 0)
            {
                selectionStart = start <= Text.Length ? start : Text.Length;
                SelectionStart = selectionStart;
            }
            ignoreOnPhoneChange = false;

            previousText = Text;
        }
Ejemplo n.º 21
0
        private void PlayerNameTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
            {
            // set each player's name based on what was typed in the text box
            if (sender == PlayerOneNameTextBox)
                _playerOne.Name = sender.Text.ToUpper();
            else if (sender == PlayerTwoNameTextBox)
                _playerTwo.Name = sender.Text.ToUpper();
            else if (sender == PlayerThreeNameTextBox)
                _playerThree.Name = sender.Text.ToUpper();
            else _playerFour.Name = sender.Text.ToUpper();

            // don't show the start game button unless each textbox has at least one character
            if ((PlayerOneNameTextBox.Text.Count() > 0) &&
                (PlayerTwoNameTextBox.Text.Count() > 0) &&
                (PlayerThreeNameTextBox.Text.Count() > 0) &&
                (PlayerFourNameTextBox.Text.Count() > 0))
                startGameStackPanel.Visibility = Visibility.Visible;
            else
                startGameStackPanel.Visibility = Visibility.Collapsed;
        }
Ejemplo n.º 22
0
        private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            var text = sender.Text;
            if (text == null || text == "") return;

            foreach (var c in text)
            {
                if (c < '0' || c > '9')
                {
                    sender.Text = text.Remove(text.IndexOf(c), 1);
                    sender.SelectionStart = sender.Text.Trim().Length;
                }
            }
            if (text.Length == 4)
            {
                sender.BorderBrush = Application.Current.Resources["ComboBoxDisabledForegroundThemeBrush"] as Brush;
            }
            else
            {
                sender.BorderBrush = new SolidColorBrush(Colors.Red);
            }
        }
Ejemplo n.º 23
0
 /// <summary>
 /// Fired whenever text is edited.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     // Update the last edit time.
     m_lastTextEditTime = DateTime.Now;
 }
Ejemplo n.º 24
0
 private void tbInput_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     ViewModel.InputText = sender.Text;
 }
 private void NameTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     if (ContactNameTextBox.Text != "")
     {
         SaveButton.IsEnabled = true;
     }
 }
Ejemplo n.º 26
0
 private void WriteValue_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     WriteBoxBackgroundCheck();
 }
Ejemplo n.º 27
0
 private void DetailsTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     DetailsWordCounterTextBlock.Text = string.Format("{0}/500", (sender as TextBox).Text.Length);
 }
Ejemplo n.º 28
0
 private void Readings_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
 }
Ejemplo n.º 29
0
 private void style_TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     //IME输入不能触发BeforeTextChanging,我估计是个Bug
     //只能在此确保绝对没有不是数字的东西混进来
     sender.Text = new string(sender.Text.Where(char.IsDigit).ToArray());
 }
Ejemplo n.º 30
0
 public void TextChanging(TextBox sender, TextBoxTextChangingEventArgs eventArgs)
 {
     Refresh();
 }
Ejemplo n.º 31
0
 private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     this.mainribbon.Title = (sender as TextBox).Text;
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Updates the URL with the value entered in the text box
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void PredictionURL_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     _LocalPersistentObject.predictionURLString = sender.Text;
 }
        private static void Textbox_TextChanging(TextBox textbox, TextBoxTextChangingEventArgs args)
        {
            var escapedMask  = textbox.GetValue(EscapedMaskProperty) as string;
            var escapedChars = textbox.GetValue(EscapedCharacterIndicesProperty) as List <int>;

            var representationDictionary = textbox.GetValue(RepresentationDictionaryProperty) as Dictionary <char, string>;
            var placeHolderValue         = textbox?.GetValue(MaskPlaceholderProperty) as string;
            var oldText            = textbox.GetValue(OldTextProperty) as string;
            var oldSelectionStart  = (int)textbox.GetValue(OldSelectionStartProperty);
            var oldSelectionLength = (int)textbox.GetValue(OldSelectionLengthProperty);

            if (string.IsNullOrWhiteSpace(escapedMask) ||
                representationDictionary == null ||
                string.IsNullOrEmpty(placeHolderValue) ||
                oldText == null)
            {
                return;
            }

            var placeHolder          = placeHolderValue[0];
            var isDeleteOrBackspace  = false;
            var deleteBackspaceIndex = 0;

            // Delete or backspace is triggered
            // if the new length is less than or equal the old text - the old selection length then a delete or backspace is triggered with or without selection and no characters is added
            if (textbox.Text.Length < oldText.Length &&
                textbox.Text.Length <= oldText.Length - oldSelectionLength)
            {
                isDeleteOrBackspace = true;
                if (oldSelectionLength == 0)
                {
                    // backspace else delete
                    if (oldSelectionStart != textbox.SelectionStart)
                    {
                        deleteBackspaceIndex++;
                    }
                }
            }

            // case adding data at the end of the textbox
            if (oldSelectionStart >= oldText.Length && !isDeleteOrBackspace)
            {
                // ignore change(s) if oldtext is a substring of new text value
                if (textbox.Text.Contains(oldText))
                {
                    textbox.Text = oldText;

                    if (oldText.Length >= 0)
                    {
                        textbox.SelectionStart = oldText.Length;
                    }

                    return;
                }
            }

            var textArray = oldText.ToCharArray();

            // detect if backspace or delete is triggered to handle the right removed character
            var newSelectionIndex = oldSelectionStart - deleteBackspaceIndex;

            // check if single selection
            var isSingleSelection = oldSelectionLength != 0 && oldSelectionLength != 1;

            // for handling single key click add +1 to match length for selection = 1
            var singleOrMultiSelectionIndex = oldSelectionLength == 0 ? oldSelectionLength + 1 : oldSelectionLength;

            // Case change due to Text property is assigned a value (Ex Textbox.Text="value")
            if (textbox.SelectionStart == 0 && textbox.FocusState == FocusState.Unfocused)
            {
                var displayText = textbox.GetValue(DefaultDisplayTextProperty) as string ?? string.Empty;
                if (string.IsNullOrEmpty(textbox.Text))
                {
                    textbox.SetValue(OldTextProperty, displayText);
                    textbox.SetValue(OldSelectionStartProperty, 0);
                    textbox.SetValue(OldSelectionLengthProperty, 0);
                    textbox.Text = displayText;
                    return;
                }
                else
                {
                    var textboxInitialValue = textbox.Text;
                    textbox.Text = displayText;
                    SetTextBoxValue(textboxInitialValue, textbox, escapedMask, escapedChars, representationDictionary, placeHolderValue[0], 0);
                    textbox.SetValue(OldTextProperty, textbox.Text);
                    return;
                }
            }

            if (!isDeleteOrBackspace)
            {
                // In case the change happened due to user input
                var selectedChar = textbox.SelectionStart > 0 ?
                                   textbox.Text[textbox.SelectionStart - 1] :
                                   placeHolder;

                var maskChar = escapedMask[newSelectionIndex];

                // If dynamic character a,9,* or custom
                if (representationDictionary.ContainsKey(maskChar) && !escapedChars.Contains(newSelectionIndex))
                {
                    var pattern = representationDictionary[maskChar];
                    if (Regex.IsMatch(selectedChar.ToString(), pattern))
                    {
                        textArray[newSelectionIndex] = selectedChar;

                        // updating text box new index
                        newSelectionIndex++;
                    }

                    // character doesn't match the pattern get the old character
                    else
                    {
                        // if single press don't change
                        if (oldSelectionLength == 0)
                        {
                            textArray[newSelectionIndex] = oldText[newSelectionIndex];
                        }

                        // if change in selection reset to default place holder instead of keeping the old valid to be clear for the user
                        else
                        {
                            textArray[newSelectionIndex] = placeHolder;
                        }
                    }
                }

                // if fixed character
                else
                {
                    textArray[newSelectionIndex] = oldText[newSelectionIndex];

                    // updating text box new index
                    newSelectionIndex++;
                }
            }

            if (isSingleSelection || isDeleteOrBackspace)
            {
                for (int i = newSelectionIndex;
                     i < (oldSelectionStart - deleteBackspaceIndex + singleOrMultiSelectionIndex);
                     i++)
                {
                    var maskChar = escapedMask[i];

                    // If dynamic character a,9,* or custom
                    if (representationDictionary.ContainsKey(maskChar) && !escapedChars.Contains(i))
                    {
                        textArray[i] = placeHolder;
                    }

                    // if fixed character
                    else
                    {
                        textArray[i] = oldText[i];
                    }
                }
            }

            textbox.Text = new string(textArray);
            textbox.SetValue(OldTextProperty, textbox.Text);
            textbox.SelectionStart = isDeleteOrBackspace ? newSelectionIndex : GetSelectionStart(escapedMask, escapedChars, newSelectionIndex, representationDictionary);
        }
 private void TipAmount_OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     //redetermines if button should be disabled
     ButtonChange();
 }
Ejemplo n.º 35
0
 public void BenefitTextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     surveyPage.BenefitTextBox_TextChanging(sender, args);
 }
Ejemplo n.º 36
0
        private static void Ctl_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            string expression = GetRegexExpression(sender);
            if (string.IsNullOrEmpty(expression)) return;

            Regex r = new Regex(expression);
            bool result = r.IsMatch(sender.Text);

            if (result)
            {
                var command = GetRegexCommand(sender);
                var parameter = GetRegexCommandParameter(sender);

                if (command != null)
                {
                    if (command.CanExecute(parameter))
                    {
                        command.Execute(parameter);
                    }
                }
            }
        }
Ejemplo n.º 37
0
 private void ManualSearchTerm( TextBox sender, TextBoxTextChangingEventArgs args ) { SearchTermUpdate(); }
        public virtual void TbOnTextChanging(object sender, TextBoxTextChangingEventArgs e)
        {

            if (AssociatedObjectAsTextBox == null)
            {
                return;
            }

            try
            {

                AssociatedObjectAsTextBox.TextChanging -= TbOnTextChanging;

                if (string.IsNullOrEmpty(AssociatedObjectAsTextBox.Text))
                {
                    NumericValue = 0;
                }

                switch (Type)
                {

                    case NumericTextBoxBehaviorType.Integer:
                        {
                            int numericValue = 0;
                            if (int.TryParse(AssociatedObjectAsTextBox.Text, out numericValue))
                            {
                                if (IsNumberRegexValid(numericValue.ToString()))
                                {
                                    NumericValue = numericValue;
                                }
                            }
                        }
                        break;

                    case NumericTextBoxBehaviorType.Double:
                        {
                            var decimalsSeparators = new char[] { '.', ',' };

                            if (decimalsSeparators.Contains(AssociatedObjectAsTextBox.Text[AssociatedObjectAsTextBox.Text.Length - 1]) && AssociatedObjectAsTextBox.Text.Where(x => decimalsSeparators.Contains(x)).Count() == 1)
                            {
                                return;
                            }

                            double numericValue = 0;
                            if (double.TryParse(AssociatedObjectAsTextBox.Text, out numericValue))
                            {
                                if (IsNumberRegexValid(numericValue.ToString()))
                                {
                                    NumericValue = numericValue;
                                }
                            }
                        }
                        break;

                }

                SetTexts();

            }
            catch (Exception)
            {
            }
            finally
            {
                
                AssociatedObjectAsTextBox.TextChanging += TbOnTextChanging;
            }



        }
Ejemplo n.º 39
0
 private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     ViewModel.UserEnteredText = sender.Text;
 }
Ejemplo n.º 40
0
 private void Text_wallpapertag_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     wallpaperTaskSettings.WPTag = sender.Text;
 }
Ejemplo n.º 41
0
 private void tbox_only_number_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     string limitStr = sender.Text;
     var m_ignoreNextTextChanged = limitStr.ToCharArray().Any(c => !Char.IsDigit(c));
     if (!m_ignoreNextTextChanged)
     {
         sender.Tag = sender.Text;
         return;
     }
     if (sender.Tag == null)
         sender.Tag = "";
     //var selectionStart = sender.SelectionStart > 1 ? sender.SelectionStart - 1 : sender.SelectionStart;
     var selectionStart = ((string)(sender.Tag)).Length + sender.SelectionStart - sender.Text.Length;
     sender.Text = (string)(sender.Tag);
     sender.SelectionStart = selectionStart;
 }
Ejemplo n.º 42
0
        private void OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs e)
        {
            Started();

            if (ignoreOnCardChange)
            {
                return;
            }

            int    start = SelectionStart;
            String str   = Text;

            if (characterAction == 3)
            {
                str = str.Substring(0, actionPosition) + str.Substring(actionPosition + 1);
                start--;
            }
            StringBuilder builder = new StringBuilder(str.Length);

            for (int a = 0; a < str.Length; a++)
            {
                char ch = str[a];
                if (char.IsDigit(ch))
                {
                    builder.Append(ch);
                }
            }
            ignoreOnCardChange = true;
            String hint      = null;
            int    maxLength = 100;

            if (builder.Length > 0)
            {
                String currentString = builder.ToString();
                for (int a = 0; a < 3; a++)
                {
                    String[] checkArr;
                    String   resultHint;
                    int      resultMaxLength;
                    switch (a)
                    {
                    case 0:
                        checkArr        = PREFIXES_16;
                        resultMaxLength = 16;
                        resultHint      = "xxxx xxxx xxxx xxxx";
                        break;

                    case 1:
                        checkArr        = PREFIXES_15;
                        resultMaxLength = 15;
                        resultHint      = "xxxx xxxx xxxx xxx";
                        break;

                    case 2:
                    default:
                        checkArr        = PREFIXES_14;
                        resultMaxLength = 14;
                        resultHint      = "xxxx xxxx xxxx xx";
                        break;
                    }
                    for (int b = 0; b < checkArr.Length; b++)
                    {
                        String prefix = checkArr[b];
                        if (currentString.Length <= prefix.Length)
                        {
                            if (prefix.StartsWith(currentString))
                            {
                                hint      = resultHint;
                                maxLength = resultMaxLength;
                                break;
                            }
                        }
                        else
                        {
                            if (currentString.StartsWith(prefix))
                            {
                                hint      = resultHint;
                                maxLength = resultMaxLength;
                                break;
                            }
                        }
                    }
                    if (hint != null)
                    {
                        break;
                    }
                }
                if (maxLength != 0)
                {
                    if (builder.Length > maxLength)
                    {
                        builder.Length = maxLength;
                    }
                }
            }
            if (hint != null)
            {
                if (maxLength != 0)
                {
                    if (builder.Length == maxLength)
                    {
                        //inputFields[FIELD_EXPIRE_DATE].requestFocus();
                    }
                }
                //phoneField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
                for (int a = 0; a < builder.Length; a++)
                {
                    if (a < hint.Length)
                    {
                        if (hint[a] == ' ')
                        {
                            builder.Insert(a, ' ');
                            a++;
                            if (start == a && characterAction != 2 && characterAction != 3)
                            {
                                start++;
                            }
                        }
                    }
                    else
                    {
                        builder.Insert(a, ' ');
                        if (start == a + 1 && characterAction != 2 && characterAction != 3)
                        {
                            start++;
                        }
                        break;
                    }
                }
            }
            else
            {
                //phoneField.setTextColor(builder.Length() > 0 ? Theme.getColor(Theme.key_windowBackgroundWhiteRedText4) : Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            }
            Text = builder.ToString();
            if (start >= 0)
            {
                //phoneField.setSelection(start <= phoneField.Length() ? start : phoneField.Length());
                selectionStart = start <= Text.Length ? start : Text.Length;
                SelectionStart = selectionStart;
            }
            ignoreOnCardChange = false;
            previousText       = Text;
        }
Ejemplo n.º 43
0
 private void tbInput_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     ViewModel.InputText = sender.Text;
 }
Ejemplo n.º 44
0
        private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            App.Setting.Text = TextBox.Text;

            Render();
        }
Ejemplo n.º 45
0
        private void txtFiltriraj_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
        {
            List<Zdravilo> neka = new List<Zdravilo>();

            foreach (var l in seznamVsehZdravilIzBaze)
            {
                if (l.Naziv.ToLower().Contains(txtFiltriraj.Text.ToLower()))
                {
                    neka.Add(l);
                }
            }

            listviewZravilo.ItemsSource = neka;
        }
Ejemplo n.º 46
0
        private void OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs w)
        {
            Started();

            if (ignoreOnCardChange)
            {
                return;
            }

            int    start = SelectionStart;
            string str   = Text;

            if (characterAction == 3)
            {
                str = str.Substring(0, actionPosition) + str.Substring(actionPosition + 1);
                start--;
            }
            StringBuilder builder = new StringBuilder(str.Length);

            for (int a = 0; a < str.Length; a++)
            {
                char ch = str[a];
                if (char.IsDigit(ch))
                {
                    builder.Append(ch);
                }
            }
            ignoreOnCardChange = true;
            //inputFields[FIELD_EXPIRE_DATE].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
            if (builder.Length > 4)
            {
                builder.Length = 4;
            }
            if (builder.Length < 2)
            {
                isYear = false;
            }
            bool isError = false;

            if (isYear)
            {
                string[] args = new string[builder.Length > 2 ? 2 : 1];
                args[0] = builder.ToString().Substring(0, 2);
                if (args.Length == 2)
                {
                    args[1] = builder.ToString().Substring(2);
                }
                if (builder.Length == 4 && args.Length == 2)
                {
                    int      month        = int.Parse(args[0]);
                    int      year         = int.Parse(args[1]) + 2000;
                    DateTime rightNow     = DateTime.Now;
                    int      currentYear  = rightNow.Year;
                    int      currentMonth = rightNow.Month + 1;
                    if (year < currentYear || year == currentYear && month < currentMonth)
                    {
                        //inputFields[FIELD_EXPIRE_DATE].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
                        isError = true;
                    }
                }
                else
                {
                    int value = int.Parse(args[0]);
                    if (value is > 12 or 0)
                    {
                        //inputFields[FIELD_EXPIRE_DATE].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
                        isError = true;
                    }
                }
            }
            else
            {
                if (builder.Length == 1)
                {
                    int value = int.Parse(builder.ToString());
                    if (value is not 1 and not 0)
                    {
                        builder.Insert(0, "0");
                        start++;
                    }
                }
                else if (builder.Length == 2)
                {
                    int value = int.Parse(builder.ToString());
                    if (value is > 12 or 0)
                    {
                        //inputFields[FIELD_EXPIRE_DATE].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
                        isError = true;
                    }
                    start++;
                }
            }
            if (!isError && builder.Length == 4)
            {
                //inputFields[need_card_name ? FIELD_CARDNAME : FIELD_CVV].requestFocus();
            }
            if (builder.Length == 2)
            {
                builder.Append('/');
                start++;
            }
            else if (builder.Length > 2 && builder[2] != '/')
            {
                builder.Insert(2, '/');
                start++;
            }

            Text = builder.ToString();
            if (start >= 0)
            {
                selectionStart = start <= Text.Length ? start : Text.Length;
                SelectionStart = selectionStart;
            }
            ignoreOnCardChange = false;

            previousText = Text;
        }
 private void SearchTextBoxt_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     pcvm.FilterProductDatabase(SearchTextBoxt.Text); //passes users search term into the vm filter method
 }
Ejemplo n.º 48
0
 private void TextBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     App.Setting.WordText = sender.Text;
 }
Ejemplo n.º 49
0
 private void tbox_email_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     itemsError.Visibility = Visibility.Collapsed;
 }
Ejemplo n.º 50
0
 private void inputBox_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     revBlock.Text = Reverse(sender.Text);
 }
Ejemplo n.º 51
0
 private void SettingChanged(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     btnSaveSettings.Visibility = Visibility.Visible;
 }
Ejemplo n.º 52
0
 private void NameInput_OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     inputButton.IsEnabled = ((TextBox) sender).Text != string.Empty;
 }
Ejemplo n.º 53
0
		// Checa se existe texto na Texbox de entrada e se ele contém apenas letras
		private void tbPalavra_TextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
		{
			string palavra = sender.Text;

			// Verifica se existe o texto e se o texto contém apenas letras
			if (palavra.Length > 0 && palavra.All(x => char.IsLetter(x)))
				btnStart.IsEnabled = true;
			else
				btnStart.IsEnabled = false;
		}
Ejemplo n.º 54
0
 private void OnTextChanging(TextBox sender, TextBoxTextChangingEventArgs args)
 {
     ParseForRichTextBlock(sender.Text);
     ParseForString(sender.Text);
 }