public virtual void Add(Point point, SearchCriteria searchCriteria)
        {
            var uiItemLocation = new UIItemLocation(point, searchCriteria);
            var existingItem   = UIItemLocations.FirstOrDefault(obj => obj.Has(searchCriteria));
            var existingPoint  = UIItemLocations.FirstOrDefault(obj => obj.Point.Equals(point));

            if (existingItem != null)
            {
                Logger.Debug(string.Format("[PositionBasedSearch] Found another UIItem {0} at {1}", searchCriteria, existingItem));
                UIItemLocations.Remove(existingItem);
            }
            else if (existingPoint != null)
            {
                Logger.Debug(string.Format("[PositionBasedSearch] UIItem {0} at {1} changed", searchCriteria, point));
                UIItemLocations.Remove(existingPoint);
            }

            UIItemLocations.Add(uiItemLocation);

            dirty = true;
        }
Exemple #2
0
        public virtual void Add(Point point, SearchCriteria searchCriteria)
        {
            var uiItemLocation = new UIItemLocation(point, searchCriteria);
            var existingItem = UIItemLocations.FirstOrDefault(obj => obj.Has(searchCriteria));
            var existingPoint = UIItemLocations.FirstOrDefault(obj => obj.Point.Equals(point));

            if (existingItem != null)
            {
                Logger.Debug(string.Format("[PositionBasedSearch] Found another UIItem {0} at {1}", searchCriteria, existingItem));
                UIItemLocations.Remove(existingItem);
            }
            else if (existingPoint != null)
            {
                Logger.Debug(string.Format("[PositionBasedSearch] UIItem {0} at {1} changed", searchCriteria, point));
                UIItemLocations.Remove(existingPoint);
            }

            UIItemLocations.Add(uiItemLocation);

            dirty = true;
        }