예제 #1
0
        public string GetSingleString(UI.Action action, UI.ParameterType parameter)
        {
            var baseValue = string.Empty;

            try
            {
                baseValue = action.Parameters.Single(x => x.ParameterType == UI.ParameterType.ServiceProxyName).DefaultValue;
            }
            catch (InvalidOperationException)
            {
                throw new CustomValidationException($"Single string parameter of type '{parameter.ToString()}' expected.");
            }

            return(baseValue);
        }
예제 #2
0
        public int GetSingleInt(UI.Action action, UI.ParameterType parameter)
        {
            var baseValue = string.Empty;

            try
            {
                baseValue = action.Parameters.Single(x => x.ParameterType == UI.ParameterType.ServiceProxyName).DefaultValue;
            }
            catch (InvalidOperationException)
            {
                throw new CustomValidationException($"Single integer parameter of type '{parameter.ToString()}' expected.");
            }

            if (!int.TryParse(baseValue, out int result))
            {
                throw new CustomValidationException($"Couldn't find or read single integer parameter '{parameter.ToString()}'.");
            }

            return(result);
        }