Example #1
0
 private void CloseDb()
 {
     if (db != null)
     {
         db.Dispose();
         db = null;
     }
 }
Example #2
0
        private void OpenFile(string fileName)
        {
            try
            {
                InvalidateCache();
                CloseDb();
                db = new ThumbCache(fileName);

                listViewEntries.LargeImageList = null;
                int w = 120;
                for (int i = 0; i < 5; i++)
                {
                    try
                    {
                        var img = GetThumbInfo(i);
                        if (img != null && img.image != null)
                        {
                            w = img.image.Width;
                            if (img.image.Height > w)
                            {
                                w = img.image.Height;
                            }
                        }
                    }
                    catch { }
                }

                if (w < 32)
                {
                    w = 32;
                }
                if (w > 240)
                {
                    w = 240;
                }

                w += 16;

                imageList1.ImageSize           = new Size(w, w);
                listViewEntries.LargeImageList = imageList1;

                listViewEntries.VirtualListSize = db.ImageCount;
                listViewEntries.Invalidate();

                this.Text = Application.ProductName + " - " + fileName;
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }