Esempio n. 1
0
        public bool DequeueView(out PostViewStoreItem view)
        {
            bool dequeuedView = false;

            view = null;

            if (items.Count > 0)
            {
                lock (items)
                {
                    view = items[0];

                    items.RemoveAt(0);

                    dequeuedView = true;
                }
            }

            return(dequeuedView);
        }
Esempio n. 2
0
        public void EnqueueView(Guid postID, string viewType)
        {
            lock (items)
            {
                PostViewStoreItem foundItem = null;

                foreach (PostViewStoreItem item in items)
                {
                    if (item.PostID == postID && string.Compare(item.ViewType, viewType, true) == 0)
                    {
                        foundItem = item;

                        item.Count++;

                        break;
                    }
                }

                if (foundItem == null)
                {
                    items.Add(new PostViewStoreItem(postID, viewType));
                }
            }
        }