/// <summary> /// Заполняем хранилище изображений из групп. Запускается в отдельном потоке. /// </summary> private void UpdateThumbnailsThread() { for (int i = 0; i < m_groups.Length; ++i) { CoreImageInfo[] images = m_groups[i].images; for (int j = 0; j < images.Length; ++j) { m_thumbnailStorage.Get(images[j]); if (m_abortUpdateThumbnailsThread) { return; } } ThumbnailGroupPanel groupPanel = m_thumbnailGroupPanels[i]; if (groupPanel != null) { ThumbnailPanel[] thumbnailPanels = groupPanel.ThumbnailPanels; for (int j = 0; j < thumbnailPanels.Length; ++j) { if (m_thumbnailStorage.Exists(thumbnailPanels[j].ImageInfo)) { thumbnailPanels[j].Thumbnail = m_thumbnailStorage.Get(thumbnailPanels[j].ImageInfo); } } } } }
private void AddGroupPanels(int indexMin, int indexMax) { List <Control> controls = new List <Control>(); for (int i = indexMin; i < indexMax; ++i) { if (m_thumbnailGroupPanels[i] == null) { ThumbnailGroupPanel groupPanel = new ThumbnailGroupPanel(m_core, m_options, m_groups[i], this); groupPanel.Location = new Point( Padding.Left + groupPanel.Margin.Left + AutoScrollPosition.X, Padding.Top + groupPanel.Margin.Top + AutoScrollPosition.Y + (groupPanel.Height + groupPanel.Margin.Vertical) * i); ThumbnailPanel[] thumbnailPanels = groupPanel.ThumbnailPanels; for (int j = 0; j < thumbnailPanels.Length; ++j) { if (m_thumbnailStorage.Exists(thumbnailPanels[j].ImageInfo)) { thumbnailPanels[j].Thumbnail = m_thumbnailStorage.Get(thumbnailPanels[j].ImageInfo); } } //groupPanel.Visible = false; controls.Add(groupPanel); m_thumbnailGroupPanels[i] = groupPanel; } } if (controls.Count > 0) { Controls.AddRange(controls.ToArray()); } }
/// <summary> /// Устанавливаем размеры таблицы /// </summary> private void UpdateControls() { SuspendDrawing(this); Controls.Clear(); int width = Padding.Horizontal; int height = Padding.Vertical; if (m_groups.Length > 0) { //Создаем массив панелей с группами дубликатов m_thumbnailGroupPanels = new ThumbnailGroupPanel[m_groups.Length]; //Добавляем пустые первую, самую большую и последнию панель с группами дубликатов AddGroupPanel(0); if (m_groups.Length > 1) { AddGroupPanel(m_groups.Length - 1); } if (m_maxGroupIndex != 0 && m_maxGroupIndex != m_groups.Length - 1) { AddGroupPanel(m_maxGroupIndex); } // Изменяем размеры таблицы в соотвествии с размерами самой большой группы ThumbnailGroupPanel maxPanel = m_thumbnailGroupPanels[m_maxGroupIndex]; height += (maxPanel.Height + maxPanel.Margin.Vertical) * m_groups.Length; width += maxPanel.Width + maxPanel.Margin.Horizontal; } AutoScrollMinSize = new Size(width, height); ResumeDrawing(this); }
public ThumbnailPanel(CoreLib core, AntiDupl.NET.Options options, CoreGroup group, int index, ThumbnailGroupPanel thumbnailGroupPanel) { m_core = core; m_options = options; m_group = group; m_index = index; m_thumbnailGroupPanel = thumbnailGroupPanel; InitializeComponents(); SetImageInfo(); }
/// <summary> /// Создаем и добавляем в хранилише m_thumbnailGroupPanels ThumbnailGroupPanel - панель с дубликатами /// </summary> /// <param name="index"></param> private void AddGroupPanel(int index) { // Если хранилище еще не содержит панелей групп if (m_thumbnailGroupPanels[index] == null) { ThumbnailGroupPanel groupPanel = new ThumbnailGroupPanel(m_core, m_options, m_groups[index], this); groupPanel.Location = new Point( Padding.Left + groupPanel.Margin.Left + AutoScrollPosition.X, Padding.Top + groupPanel.Margin.Top + AutoScrollPosition.Y + (groupPanel.Height + groupPanel.Margin.Vertical) * index); ThumbnailPanel[] thumbnailPanels = groupPanel.ThumbnailPanels; for (int i = 0; i < thumbnailPanels.Length; ++i) { if (m_thumbnailStorage.Exists(thumbnailPanels[i].ImageInfo)) { thumbnailPanels[i].Thumbnail = m_thumbnailStorage.Get(thumbnailPanels[i].ImageInfo); } } m_thumbnailGroupPanels[index] = groupPanel; Controls.Add(groupPanel); m_changeControls = true; Console.Write("a"); } }