Example #1
0
        void LoadMetaData(int index)
        {
            ClearTrackPanels();
            Clear(false);
            int panelYPos   = 10;
            int totalValues = tagReader.sortedFilePaths.Count;

            Thread.Sleep(10);
            InitStatus(totalValues);

            Dictionary <uint, Image> hashCodes = new Dictionary <uint, Image>();

            foreach (string path in tagReader.sortedFilePaths.Values)
            {
                IPicture iPicture   = null;
                Image    finalCover = null;
                if (tagReader.GetTagsFromPath(path).Pictures.Length != 0)
                {
                    iPicture = tagReader.GetTagsFromPath(path).Pictures[0];
                    uint hash = iPicture.Data.Checksum;
                    if (!hashCodes.ContainsKey(hash))
                    {
                        hashCodes.Add(hash, utils.IPictureToImage(iPicture, 24));
                    }
                    finalCover = hashCodes[hash];
                }
                TrackPanel trackPanel = new TrackPanel(path, finalCover, tagReader.GetTagsFromPath(path).Title, themeManager)
                {
                    Location = new Point(10, panelYPos),
                    Size     = new Size(mainPanel.ClientSize.Width - 20, 32)
                };
                mainPanel.Controls.Add(trackPanel);

                trackPanel.MouseClick       += mouseClick;
                trackPanel.Label.MouseClick += mouseClick;
                panelYPos += TRACKPANEL_Y_OFFSET;

                UpdateStatus("Displaying Files", (panelYPos / 42), totalValues);
            }
            loadMetadataIntoDetailsBox(tagReader.GetTagsFromPath(tagReader.sortedFilePaths[index]));
            status.Text = "Done.";
        }