/// <summary> /// Remove the item from the collection on the basis of instance of the field. /// </summary> /// <param name="mapField"></param> public void Remove(MapPicture picField) { this.InnerList.Remove(picField); }
/// <summary> /// Move the field on the top of the collection. /// </summary> /// <param name="mapField"></param> private void MoveToTop(MapPicture mapField) { this.InnerList.Remove(mapField); this.InnerList.Insert(0, mapField); }
/// <summary> /// Add the details into the collection /// </summary> /// <param name="map"></param> public void Add(MapPicture picture) { bool NewField = true; foreach (MapPicture PicField in this.InnerList) { if (PicField.RecentPicture == picture.RecentPicture) { NewField = false; //-- If the item already exists, then it send that item onto the top this.MoveToTop(picture); break; } } // -- Font list add only 15 items. 1st item will remove if user want to add more items into the collection. It works on FIFO basis. if (this.InnerList.Count > 15 && NewField) { this.InnerList.RemoveAt(0); this.InnerList.Add(picture); } else if (NewField) { this.InnerList.Add(picture); } }