/// <summary> /// Registers a board into this collection. /// </summary> /// <param name="board">The board to register</param> /// <param name="tags">Optional tag to associate the board with. Can be used to differente a list of boards for retrieval later. /// This comes in handly when you have for example boards for one mode vs another mode such as free vs paid.</param> public void RegisterWithTags(Board board, string[] tags) { if (board == null) throw new ArgumentException("Board to load is null"); // Any tags ? if (tags == null || tags.Length == 0) { Register(board); return; } for (int ndx = 0; ndx < tags.Length; ndx++) { string tag = tags[ndx]; List<Board> boardList = null; if (_boardsByTag.ContainsKey(tag)) { boardList = _boardsByTag[tag]; // Avoid adding duplicate boards. if (!boardList.Contains(board)) boardList.Add(board); } else { boardList = new List<Board>(); _boardsByTag[tag] = boardList; boardList.Add(board); } } }
/// <summary> /// Registers a board into this collection using a default list /// </summary> /// <param name="board">The board to register</param> public void Register(Board board) { if (board == null) throw new ArgumentException("Board to load is null"); List<Board> boardList = GetOrCreateBoardList(DEFAULT_LIST_TAG); if (!boardList.Contains(board)) boardList.Add(board); }