Example #1
0
        /// <summary>
        /// Invoked by the worker thread to update item details.
        /// </summary>
        internal void UpdateDetailsInternal(VirtualItemDetailsEventArgs info)
        {
            if (!isDirty)
            {
                return;
            }

            mDateAccessed = info.DateAccessed;
            mDateCreated  = info.DateCreated;
            mDateModified = info.DateModified;
            mFileName     = info.FileName;
            mFileSize     = info.FileSize;
            mFileType     = info.FileType;
            mFilePath     = info.FilePath;
            mDimensions   = info.Dimensions;
            mResolution   = info.Resolution;
            // Exif tags
            mImageDescription = info.ImageDescription;
            mEquipmentModel   = info.EquipmentModel;
            mDateTaken        = info.DateTaken;
            mArtist           = info.Artist;
            mCopyright        = info.Copyright;
            mExposureTime     = info.ExposureTime;
            mFNumber          = info.FNumber;
            mISOSpeed         = info.ISOSpeed;
            mShutterSpeed     = info.ShutterSpeed;
            mAperture         = info.Aperture;
            mUserComment      = info.UserComment;

            isDirty = false;
        }
Example #2
0
        /// <summary>
        /// Updates file info for the image file represented by this item.
        /// </summary>
        private void UpdateFileInfo()
        {
            if (!isDirty)
            {
                return;
            }

            if (isVirtualItem)
            {
                if (mImageListView != null)
                {
                    VirtualItemDetailsEventArgs e = new VirtualItemDetailsEventArgs(mVirtualItemKey);
                    mImageListView.RetrieveVirtualItemDetailsInternal(e);
                    UpdateDetailsInternal(e);
                }
            }
            else
            {
                Utility.ShellImageFileInfo info = new Utility.ShellImageFileInfo(mFileName);
                UpdateDetailsInternal(info);
            }
            isDirty = false;
        }
Example #3
0
        /// <summary>
        /// Used by the worker thread to read item data.
        /// </summary>
        private void DoWork()
        {
            while (!Stopping)
            {
                CacheItem item = null;
                lock (lockObject)
                {
                    // Wait until we have items waiting to be cached
                    if (toCache.Count == 0)
                    {
                        Monitor.Wait(lockObject);
                    }

                    // Get an item from the queue
                    if (toCache.Count != 0)
                    {
                        item = toCache.Dequeue();

                        // Is it being edited?
                        if (editCache.ContainsKey(item.Item.Guid))
                        {
                            item = null;
                        }
                    }
                }

                // Read file info
                if (item != null)
                {
                    if (item.IsVirtualItem)
                    {
                        if (mImageListView != null && mImageListView.IsHandleCreated && !mImageListView.IsDisposed)
                        {
                            VirtualItemDetailsEventArgs e = new VirtualItemDetailsEventArgs(item.VirtualItemKey);
                            mImageListView.RetrieveVirtualItemDetailsInternal(e);
                            mImageListView.Invoke(new UpdateVirtualItemDetailsDelegateInternal(
                                                      mImageListView.UpdateItemDetailsInternal), item.Item, e);
                        }
                    }
                    else
                    {
                        Utility.ShellImageFileInfo info = new Utility.ShellImageFileInfo(item.FileName);
                        // Update file info
                        if (!Stopping)
                        {
                            try
                            {
                                if (mImageListView != null && mImageListView.IsHandleCreated && !mImageListView.IsDisposed)
                                {
                                    mImageListView.Invoke(new UpdateItemDetailsDelegateInternal(
                                                              mImageListView.UpdateItemDetailsInternal), item.Item, info);
                                }
                            }
                            catch (ObjectDisposedException)
                            {
                                if (!Stopping)
                                {
                                    throw;
                                }
                            }
                            catch (InvalidOperationException)
                            {
                                if (!Stopping)
                                {
                                    throw;
                                }
                            }
                        }
                    }
                }
            }

            lock (lockObject)
            {
                stopped = true;
            }
        }