Esempio n. 1
0
        public static int Parse(this string input, int oldValue)
        {
            int newValue;
            var parsed = int.TryParse(input, out newValue);

            if (!parsed)
            {
                MessageBoxExtension.ShowWarning(onlyIntegerMessage);
                return(oldValue);
            }
            return(newValue);
        }
Esempio n. 2
0
        private static T ParseAndValidate <T>(bool parsed, T newValue, T oldValue, IValidator <T> validator, string parseFailedMessage)
        {
            if (!parsed)
            {
                MessageBoxExtension.ShowWarning(parseFailedMessage);
                return(oldValue);
            }

            if (!validator.IsValid(newValue))
            {
                MessageBoxExtension.ShowWarning(validator.GetInvalidInfoMessage());
                return(oldValue);
            }

            return(newValue);
        }
Esempio n. 3
0
 public void OnError(Exception error)
 {
     MessageBoxExtension.ShowError(error.Message);
 }