Пример #1
0
 public void NotifyLevelAdded_Synched(int index, LevelMetadata level)
 {
     for (int i = 0; i < cursors.Count; ++i)
     {
         LevelSetCursor cursor = cursors[i];
         cursor.LevelAdded(index, level);
     }
 }
Пример #2
0
 public void NotifyLevelRemoved_Synched(int index)
 {
     for (int i = 0; i < cursors.Count; ++i)
     {
         LevelSetCursor cursor = cursors[i];
         cursor.LevelRemoved(index);
     }
 }
        public ILevelSetCursor OpenCursor(
            Guid desiredSelection,
            ILevelSetSorter sorter,
            ILevelSetFilter filter,
            LevelSetQueryEvent notifyFetchingCallback,
            LevelSetQueryEvent notifyFetchCompleteCallback,
            LevelSetCursorShifted shiftCallback,
            LevelSetCursorJumped jumpCallback,
            LevelSetCursorAddition additionCallback,
            LevelSetCursorRemoval removalCallback,
            int size)
        {
            LevelSetCursor cursor;

            lock (Synch)
            {
                ILevelSetQuery query = new LevelSetQuery(
                    sorter,
                    filter,
                    this,
                    notifyFetchingCallback,
                    notifyFetchCompleteCallback);

                queries.Add(query);

                cursor = new LevelSetCursor(
                    this,
                    desiredSelection,
                    query,
                    shiftCallback,
                    jumpCallback,
                    additionCallback,
                    removalCallback,
                    size);

                query.AddCursor(cursor);
            }

            return(cursor);
        }
        public void CloseCursor(ref ILevelSetCursor icursor)
        {
            LevelSetCursor cursor = icursor as LevelSetCursor;

            if (cursor != null)
            {
                lock (Synch)
                {
                    int index = queries.IndexOf(cursor.Query);

                    if (index >= 0)
                    {
                        ILevelSetQuery query = queries[index];
                        if (0 == query.RemoveCursor(cursor))
                        {
                            queries.RemoveAt(index);
                        }
                    }
                }

                icursor = null;
            }
        }