예제 #1
0
        /// <summary>
        /// Returns the control associated with the field passed across. Returns null if the pageObject passed
        /// across does not match the pageObject held by the page.
        /// </summary>
        /// <param name="pageObject"></param>
        /// <param name="validationField"></param>
        /// <param name="isClearMessage"></param>
        /// <returns></returns>
        public Control GetControlForValidationField(object pageObject, ValidationField validationField, bool isClearMessage)
        {
            Control result = null;

            if (pageObject == PageObject)
            {
                _ValidationFieldControlMap.TryGetValue(validationField, out result);

                if (result == null && !isClearMessage && _ValidationFieldControlMap.ContainsKey(validationField))
                {
                    // The page hasn't been created and it has a validation error on it - create the page and try again
                    SettingsView.CreatePage(this);
                    _ValidationFieldControlMap.TryGetValue(validationField, out result);
                }
            }

            return(result);
        }