Example #1
0
        public void addUIState(IEnumerable <MediaItem> items)
        {
            if (items.Count() == 0)
            {
                return;
            }

            UIMediaCollection.EnterWriteLock();

            if (DebugOutput)
            {
                Logger.Log.Info("begin add event: " + items.ElementAt(0).Location);
            }

            try
            {
                UIMediaCollection.AddRange(items);
            }
            finally
            {
                if (DebugOutput)
                {
                    Logger.Log.Info("end add event: " + items.ElementAt(0).Location);
                }

                UIMediaCollection.ExitWriteLock();

                fireEvents(MediaStateChangedAction.Add, items);
            }
        }
Example #2
0
        public void removeUIState(IEnumerable <MediaItem> removeItems)
        {
            if (removeItems.Count() == 0)
            {
                return;
            }

            List <MediaItem> removed = new List <MediaItem>();

            UIMediaCollection.EnterWriteLock();
            if (DebugOutput)
            {
                Logger.Log.Info("begin remove event: " + removeItems.ElementAt(0).Location);
            }

            try
            {
                removed = UIMediaCollection.RemoveRange(removeItems);
            }
            finally
            {
                if (DebugOutput)
                {
                    Logger.Log.Info("end remove event: " + removeItems.ElementAt(0).Location);
                }
                UIMediaCollection.ExitWriteLock();

                fireEvents(MediaStateChangedAction.Remove, removed);
            }
        }
Example #3
0
        public void clearUIState(String stateInfo, DateTime stateDateTime, MediaStateType stateType)
        {
            UIMediaCollection.EnterWriteLock();

            try
            {
                UIMediaCollection.Clear();

                MediaStateInfo     = stateInfo;
                MediaStateDateTime = stateDateTime;
                MediaStateType     = stateType;
            }
            finally
            {
                UIMediaCollection.ExitWriteLock();

                fireEvents(MediaStateChangedAction.Clear, null);
            }
        }
Example #4
0
        public override void changedUIState(IEnumerable <MediaItem> changedItems)
        {
            foreach (MediaFileItem item in changedItems)
            {
                FileInfo info = new FileInfo(item.Location);
                info.Refresh();

                if (info.Exists)
                {
                    UIMediaCollection.EnterWriteLock();
                    try
                    {
                        UIMediaCollection.Reload(item);
                    }
                    finally
                    {
                        UIMediaCollection.ExitWriteLock();
                    }
                }
            }
        }