Пример #1
0
        private IList <IField> FindCommonFields()
        {
            IList <IField> returnFields = null;

            if (_boundContainers.Count > 0)
            {
                // take all fields from the least selected container...
                DrawableContainer leastSelectedContainer = _boundContainers[_boundContainers.Count - 1] as DrawableContainer;
                if (leastSelectedContainer != null)
                {
                    returnFields = leastSelectedContainer.GetFields();
                    for (int i = 0; i < _boundContainers.Count - 1; i++)
                    {
                        DrawableContainer dc = _boundContainers[i] as DrawableContainer;
                        if (dc != null)
                        {
                            IList <IField> fieldsToRemove = new List <IField>();
                            foreach (IField field in returnFields)
                            {
                                // ... throw out those that do not apply to one of the other containers
                                if (!dc.HasField(field.FieldType))
                                {
                                    fieldsToRemove.Add(field);
                                }
                            }
                            foreach (var field in fieldsToRemove)
                            {
                                returnFields.Remove(field);
                            }
                        }
                    }
                }
            }
            return(returnFields ?? new List <IField>());
        }