Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initialize the filter so it can check for matches in reference collections.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void InitReferenceCriteria(ICmCell cell, int filteredFlid)
        {
            cell.ParseObjectMatchCriteria();

            if (cell is CmCell && ((CmCell)cell).MatchOnlyEmptyRefCollection)
            {
                return;
            }

            // Do we need to prompt the user for the value he wants to match?
            if (cell.MatchValue == 0 || ShowPrompt == 1)
            {
                // Prompt the user for a possibility.
                Debug.Assert(m_userView != null);
                Debug.Assert(m_possSupplier != null);
                int hvoPossList = m_userView.GetPossibilityListForProperty(filteredFlid);
                if (hvoPossList == 0)
                {
                    throw new Exception("Couldn't find appropriate Possibility List to prompt for filter criteria");
                }

                // The possibility supplier actually displays the Chooser dialog to prompt the user.
                int hvoPoss = m_possSupplier.GetPossibility(
                    new CmPossibilityList(m_cache, hvoPossList), cell.MatchValue);

                if (hvoPoss == 0)
                {
                    throw new Exception("User cancelled Filter");
                }

                cell.MatchValue = hvoPoss;
            }
        }