Пример #1
0
        void onAcceptPressed()
        {
            ValidateInputEventArgs args = new ValidateInputEventArgs(UserInput);

            ValidateUserInput?.Invoke(this, args);
            if (args.ValidationSucceeded)
            {
                UserInputAccepted?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                UserInputRejected?.Invoke(this, EventArgs.Empty);
            }
        }
Пример #2
0
        private void RequestInputVM_ValidateUserInput(object sender, ValidateInputEventArgs e)
        {
            double val;

            if (!double.TryParse(e.TextToValidate, out val))
            {
                MessageBox.Show("Input must be in seconds");
                return;
            }
            if (val < 5)
            {
                MessageBox.Show("Minimum seconds is 5, enter a number greater than 5");
                return;
            }
            Console.WriteLine("validation success!");
            e.ValidationSucceeded = true;
        }