/// <summary>
        /// Invoked by the worker thread to update item details.
        /// </summary>
        /// <param name="info">Item details.</param>
        internal void UpdateDetailsInternal(Utility.Tuple<ColumnType, string, object>[] info)
        {
            if (!isDirty) return;
            if (info == null) return;

            // File info
            foreach (Utility.Tuple<ColumnType, string, object> item in info)
            {
                switch (item.Item1)
                {
                    case ColumnType.DateAccessed:
                        mDateAccessed = (DateTime)item.Item3;
                        break;
                    case ColumnType.DateCreated:
                        mDateCreated = (DateTime)item.Item3;
                        break;
                    case ColumnType.DateModified:
                        mDateModified = (DateTime)item.Item3;
                        break;
                    case ColumnType.FileSize:
                        mFileSize = (long)item.Item3;
                        break;
                    case ColumnType.FilePath:
                        mFilePath = (string)item.Item3;
                        break;
                    case ColumnType.Dimensions:
                        mDimensions = (Size)item.Item3;
                        break;
                    case ColumnType.Resolution:
                        mResolution = (SizeF)item.Item3;
                        break;
                    case ColumnType.ImageDescription:
                        mImageDescription = (string)item.Item3;
                        break;
                    case ColumnType.EquipmentModel:
                        mEquipmentModel = (string)item.Item3;
                        break;
                    case ColumnType.DateTaken:
                        mDateTaken = (DateTime)item.Item3;
                        break;
                    case ColumnType.Artist:
                        mArtist = (string)item.Item3;
                        break;
                    case ColumnType.Copyright:
                        mCopyright = (string)item.Item3;
                        break;
                    case ColumnType.ExposureTime:
                        mExposureTime = (float)item.Item3;
                        break;
                    case ColumnType.FNumber:
                        mFNumber = (float)item.Item3;
                        break;
                    case ColumnType.ISOSpeed:
                        mISOSpeed = (ushort)item.Item3;
                        break;
                    case ColumnType.UserComment:
                        mUserComment = (string)item.Item3;
                        break;
                    case ColumnType.Rating:
                        mRating = (ushort)item.Item3;
                        break;
                    case ColumnType.Software:
                        mSoftware = (string)item.Item3;
                        break;
                    case ColumnType.FocalLength:
                        mFocalLength = (float)item.Item3;
                        break;
                    case ColumnType.Custom:
                        string label = item.Item2;
                        string value = (string)item.Item3;
                        Guid columnID = Guid.Empty;
                        foreach (ImageListView.ImageListViewColumnHeader column in mImageListView.Columns)
                        {
                            if (label == column.Text)
                                columnID = column.Guid;
                        }
                        if (columnID == Guid.Empty)
                        {
                            ImageListView.ImageListViewColumnHeader column = new ImageListView.ImageListViewColumnHeader(ColumnType.Custom, label);
                            columnID = column.Guid;
                        }
                        if (subItems.ContainsKey(columnID))
                            subItems[columnID] = value;
                        else
                            subItems.Add(columnID, value);
                        break;
                    default:
                        throw new Exception("Unknown column type.");
                }
            }

            UpdateRating();

            isDirty = false;
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the ColumnHoverEventArgs class.
 /// </summary>
 /// <param name="column">The currently hovered column.</param>
 /// <param name="previousColumn">The previously hovered column.</param>
 public ColumnHoverEventArgs(ImageListView.ImageListViewColumnHeader column, ImageListView.ImageListViewColumnHeader previousColumn)
 {
     mColumn = column;
     mPreviousColumn = previousColumn;
 }
            /// <summary>
            /// Draws the column headers.
            /// </summary>
            /// <param name="g">The System.Drawing.Graphics to draw on.</param>
            /// <param name="column">The ImageListViewColumnHeader to draw.</param>
            /// <param name="state">The current view state of column.</param>
            /// <param name="bounds">The bounding rectangle of column in client coordinates.</param>
            public override void DrawColumnHeader(Graphics g, ImageListView.ImageListViewColumnHeader column, ColumnState state, Rectangle bounds)
            {
                // Paint background
                if (mImageListView.Focused && ((state & ColumnState.Hovered) == ColumnState.Hovered))
                {
                    using (Brush bHovered = new LinearGradientBrush(bounds,
                                                                    Color.FromArgb(64, 96, 144, 240), Color.FromArgb(196, 96, 144, 240), LinearGradientMode.Vertical))
                    {
                        g.FillRectangle(bHovered, bounds);
                    }
                }
                else
                {
                    using (Brush bNormal = new LinearGradientBrush(bounds,
                                                                   Color.FromArgb(32, 128, 128, 128), Color.FromArgb(196, 128, 128, 128), LinearGradientMode.Vertical))
                    {
                        g.FillRectangle(bNormal, bounds);
                    }
                }
                using (Brush bBorder = new LinearGradientBrush(bounds,
                                                               Color.FromArgb(96, 128, 128, 128), Color.FromArgb(128, 128, 128), LinearGradientMode.Vertical))
                    using (Pen pBorder = new Pen(bBorder))
                    {
                        g.DrawLine(pBorder, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom);
                        g.DrawLine(pBorder, bounds.Left, bounds.Bottom - 1, bounds.Right, bounds.Bottom - 1);
                    }
                using (Pen pen = new Pen(Color.FromArgb(16, Color.White)))
                {
                    g.DrawLine(pen, bounds.Left + 1, bounds.Top + 1, bounds.Left + 1, bounds.Bottom - 2);
                    g.DrawLine(pen, bounds.Right - 1, bounds.Top + 1, bounds.Right - 1, bounds.Bottom - 2);
                }

                // Draw the sort arrow
                int textOffset = 4;

                if (mImageListView.SortOrder != SortOrder.None && mImageListView.SortColumn == column.Type)
                {
                    Image img = null;
                    if (mImageListView.SortOrder == SortOrder.Ascending)
                    {
                        img = ImageListViewResources.SortAscending;
                    }
                    else if (mImageListView.SortOrder == SortOrder.Descending)
                    {
                        img = ImageListViewResources.SortDescending;
                    }
                    g.DrawImageUnscaled(img, bounds.X + 4, bounds.Top + (bounds.Height - img.Height) / 2);
                    textOffset += img.Width;
                }

                // Text
                bounds.X     += textOffset;
                bounds.Width -= textOffset;
                if (bounds.Width > 4)
                {
                    using (StringFormat sf = new StringFormat())
                    {
                        sf.FormatFlags   = StringFormatFlags.NoWrap;
                        sf.Alignment     = StringAlignment.Near;
                        sf.LineAlignment = StringAlignment.Center;
                        sf.Trimming      = StringTrimming.EllipsisCharacter;
                        using (Brush brush = new SolidBrush(Color.White))
                        {
                            g.DrawString(column.Text,
                                         (mImageListView.HeaderFont == null ? mImageListView.Font : mImageListView.HeaderFont),
                                         brush, bounds, sf);
                        }
                    }
                }
            }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the ColumnEventArgs class.
 /// </summary>
 /// <param name="column">The column that is the target of this event.</param>
 public ColumnEventArgs(ImageListView.ImageListViewColumnHeader column)
 {
     mColumn = column;
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the ColumnClickEventArgs class.
 /// </summary>
 /// <param name="column">The column that is the target of this event.</param>
 /// <param name="location">The location of the mouse.</param>
 /// <param name="buttons">One of the System.Windows.Forms.MouseButtons values 
 /// indicating which mouse button was pressed.</param>
 public ColumnClickEventArgs(ImageListView.ImageListViewColumnHeader column, Point location, MouseButtons buttons)
 {
     mColumn = column;
     mLocation = location;
     mButtons = buttons;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the ColumnHoverEventArgs class.
 /// </summary>
 /// <param name="column">The currently hovered column.</param>
 /// <param name="previousColumn">The previously hovered column.</param>
 public ColumnHoverEventArgs(ImageListView.ImageListViewColumnHeader column, ImageListView.ImageListViewColumnHeader previousColumn)
 {
     mColumn         = column;
     mPreviousColumn = previousColumn;
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the ColumnClickEventArgs class.
 /// </summary>
 /// <param name="column">The column that is the target of this event.</param>
 /// <param name="location">The location of the mouse.</param>
 /// <param name="buttons">One of the System.Windows.Forms.MouseButtons values
 /// indicating which mouse button was pressed.</param>
 public ColumnClickEventArgs(ImageListView.ImageListViewColumnHeader column, Point location, MouseButtons buttons)
 {
     mColumn   = column;
     mLocation = location;
     mButtons  = buttons;
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new instance of the ColumnEventArgs class.
 /// </summary>
 /// <param name="column">The column that is the target of this event.</param>
 public ColumnEventArgs(ImageListView.ImageListViewColumnHeader column)
 {
     mColumn = column;
 }