コード例 #1
0
        /// <summary>
        /// Invoked by the worker thread to update item details.
        /// </summary>
        internal void UpdateDetailsInternal(Utility.ShellImageFileInfo info)
        {
            if (!isDirty)
            {
                return;
            }

            mDateAccessed = info.LastAccessTime;
            mDateCreated  = info.CreationTime;
            mDateModified = info.LastWriteTime;
            mFileSize     = info.Size;
            mFileType     = info.TypeName;
            mFilePath     = info.DirectoryName;
            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.ApertureValue;
            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>
        /// 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;
            }
        }
コード例 #4
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;
        }
コード例 #5
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;
            }
        }
コード例 #6
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)
                {
                    long requestedTickCount = Utility.TickCount();
                    RetrieveItemMetadataDetailsEventArgs e = new RetrieveItemMetadataDetailsEventArgs(item.FileName);
                    mImageListView.RetrieveItemMetadataDetailsInternal(e);


                    Utility.ShellImageFileInfo info;
                    if (e.FileMetadata != null)
                    {
                        info = e.FileMetadata;
                    }
                    else //If not handel outside, try internal
                    {
                        info = new Utility.ShellImageFileInfo(item.FileName);
                    }

                    // Update file info
                    if (!Stopping)
                    {
                        try
                        {
                            if (mImageListView != null && mImageListView.IsHandleCreated && !mImageListView.IsDisposed && mImageListView.Enabled)
                            {
                                mImageListView.Invoke(new UpdateItemDetailsDelegateInternal(mImageListView.UpdateItemDetailsInternal), item.Item, info, requestedTickCount);
                            }
                        }
                        catch (ObjectDisposedException ex)
                        {
                            Logger.Warn("DoWork: " + ex.Message);
                            //if (!stopping) throw;
                        }
                        catch (InvalidOperationException ex)
                        {
                            Logger.Warn("DoWork: " + ex.Message);
                            //if (!stopping) throw;
                        }
                    }
                }
            }

            lock (lockObject)
            {
                stopped = true;
            }
        }