Пример #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;
        }
Пример #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;
        }
Пример #3
0
 /// <summary>
 /// Raises the RetrieveVirtualItemDetails event.
 /// </summary>
 /// <param name="e">A VirtualItemDetailsEventArgs that contains event data.</param>
 protected virtual void OnRetrieveVirtualItemDetails(VirtualItemDetailsEventArgs e)
 {
     if (RetrieveVirtualItemDetails != null)
         RetrieveVirtualItemDetails(this, e);
 }
Пример #4
0
 /// <summary>
 /// Updates item details.
 /// This method is invoked from the item cache thread.
 /// </summary>
 internal void UpdateItemDetailsInternal(ImageListViewItem item, VirtualItemDetailsEventArgs info)
 {
     item.UpdateDetailsInternal(info);
 }
Пример #5
0
 /// <summary>
 /// Raises the RetrieveVirtualItemDetails event.
 /// This method is invoked from the thumbnail thread.
 /// </summary>
 /// <param name="e">A VirtualItemDetailsEventArgs that contains event data.</param>
 internal virtual void RetrieveVirtualItemDetailsInternal(VirtualItemDetailsEventArgs e)
 {
     OnRetrieveVirtualItemDetails(e);
 }
        /// <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;
            }
        }
Пример #7
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;
        }
Пример #8
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;
        }
        /// <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;
            }
        }