Пример #1
0
        // Callbacks are called on our own thread that already has lock -> no locking needed here
        private void AlbumBrowseCompleteCallback(IntPtr albumBrowsePtr, IntPtr userDataPtr)
        {
            AlbumBrowse albumBrowse = new AlbumBrowse(albumBrowsePtr);
            int         id          = userDataPtr.ToInt32();

            object state = states.ContainsKey(id) ? states[id] : null;

            if (id <= short.MaxValue)
            {
                states.Remove(id);
                EnqueueEventWorkItem(new EventWorkItem(OnAlbumBrowseComplete, new object[] { this, new AlbumBrowseEventArgs(albumBrowse, state) }));
            }
            else
            {
                if (state != null && state is ManualResetEvent)
                {
                    states[id] = albumBrowse;
                    (state as ManualResetEvent).Set();
                }
            }
        }
Пример #2
0
        // Callbacks are called on our own thread that already has lock -> no locking needed here
        private void AlbumBrowseCompleteCallback(IntPtr albumBrowsePtr, IntPtr userDataPtr)
        {
            AlbumBrowse albumBrowse = new AlbumBrowse(albumBrowsePtr);
            int id = userDataPtr.ToInt32();

            object state = states.ContainsKey(id) ? states[id] : null;

            if (id <= short.MaxValue)
            {
                states.Remove(id);
                EnqueueEventWorkItem(new EventWorkItem(OnAlbumBrowseComplete, new object[] { this, new AlbumBrowseEventArgs(albumBrowse, state) }));
            }
            else
            {
                if (state != null && state is ManualResetEvent)
                {
                    states[id] = albumBrowse;
                    (state as ManualResetEvent).Set();
                }
            }
        }
		internal AlbumBrowseEventArgs(AlbumBrowse result, object state)
		{
			this.result = result;
			this.state = state;
		}
 internal AlbumBrowseEventArgs(AlbumBrowse result, object state)
 {
     this.result = result;
     this.state  = state;
 }