Beispiel #1
0
        /// <summary>
        /// Requests that the focus be released from the passed in component
        /// </summary>
        /// <param name="component">the component that focus is being requested for</param>
        /// <returns>true if the focus was successfully transferred to the passed in PageComponent</returns>
        public bool ReleaseFocusFromComponent(PageComponent component)
        {
            if (CUIUtility.IsNullOrUndefined(component))
                return false;

            if (!_activeComponents.Contains(component))
                return true;

            _activeComponents.Remove(component);
            HandleQuickLookup();
            component.YieldFocus();
            return true;
        }
Beispiel #2
0
        /// <summary>
        /// Removes the focus so that no PageComponent has the focus
        /// </summary>
        /// <returns>true if the focus was successfully removed</returns>
        public bool ReleaseAllFoci()
        {
            // We need to do this here in case some of the components execute commands in their "Yield()" method.
            // This is equivalent to a call to HandleQuickLookup()
            _focusedComponents = new Dictionary <ICommandHandler, PageComponent>();

            int length = _activeComponents.Count;

            for (int i = length - 1; i >= 0; i--)
            {
                PageComponent comp = (PageComponent)_activeComponents[i];
                _activeComponents.Remove(comp);
                comp.YieldFocus();
            }

            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// Requests that the focus be released from the passed in component
        /// </summary>
        /// <param name="component">the component that focus is being requested for</param>
        /// <returns>true if the focus was successfully transferred to the passed in PageComponent</returns>
        public bool ReleaseFocusFromComponent(PageComponent component)
        {
            if (CUIUtility.IsNullOrUndefined(component))
            {
                return(false);
            }

            if (!_activeComponents.Contains(component))
            {
                return(true);
            }

            _activeComponents.Remove(component);
            HandleQuickLookup();
            component.YieldFocus();
            return(true);
        }