This commit is contained in:
devil_1nc 2024-06-24 17:13:11 +04:00
commit dfbbdb049a
2 changed files with 42 additions and 8 deletions

View File

@ -35,8 +35,10 @@
buttonSelectFile = new Button();
labelFile = new Label();
groupBox1 = new GroupBox();
dataGridView = new DataGridView();
groupBoxFiles.SuspendLayout();
groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// groupBoxFiles
@ -45,10 +47,10 @@
groupBoxFiles.Dock = DockStyle.Left;
groupBoxFiles.Location = new Point(0, 0);
groupBoxFiles.Name = "groupBoxFiles";
groupBoxFiles.Size = new Size(282, 439);
groupBoxFiles.Size = new Size(282, 586);
groupBoxFiles.TabIndex = 0;
groupBoxFiles.TabStop = false;
groupBoxFiles.Text = айлы";
groupBoxFiles.Text = отографии";
//
// panelFiles
//
@ -56,7 +58,7 @@
panelFiles.Dock = DockStyle.Fill;
panelFiles.Location = new Point(3, 19);
panelFiles.Name = "panelFiles";
panelFiles.Size = new Size(276, 417);
panelFiles.Size = new Size(276, 564);
panelFiles.TabIndex = 0;
//
// comboBoxProduct
@ -104,18 +106,28 @@
groupBox1.Controls.Add(buttonAdd);
groupBox1.Controls.Add(buttonSelectFile);
groupBox1.Dock = DockStyle.Right;
groupBox1.Location = new Point(466, 0);
groupBox1.Location = new Point(678, 0);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(200, 439);
groupBox1.Size = new Size(200, 586);
groupBox1.TabIndex = 5;
groupBox1.TabStop = false;
groupBox1.Text = "groupBox1";
//
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Fill;
dataGridView.Location = new Point(282, 0);
dataGridView.Name = "dataGridView";
dataGridView.Size = new Size(396, 586);
dataGridView.TabIndex = 6;
//
// FormMediaFiles
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(666, 439);
ClientSize = new Size(878, 586);
Controls.Add(dataGridView);
Controls.Add(groupBox1);
Controls.Add(groupBoxFiles);
Name = "FormMediaFiles";
@ -125,6 +137,7 @@
groupBoxFiles.ResumeLayout(false);
groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
}
@ -137,5 +150,6 @@
private Label labelFile;
private GroupBox groupBox1;
private Panel panelFiles;
private DataGridView dataGridView;
}
}

View File

@ -33,6 +33,19 @@ namespace WinFormsApp
private void LoadData()
{
if (comboBoxProduct.SelectedIndex < 0) return;
_logger.LogInformation("Загрузка файлов");
try
{
var filelist = _mediafileLogic.ReadList(null);
if (filelist != null)
{
dataGridView.DataSource = filelist;
}
}
catch (Exception ex)
{
}
var list = _mediafileLogic.ReadList(new MediaFileSearchModel()
{
ProductId = (Guid?)comboBoxProduct.SelectedValue ?? Guid.Empty,
@ -47,6 +60,13 @@ namespace WinFormsApp
panelFiles.Controls.Add(imageBox);
imageBox.SizeMode = PictureBoxSizeMode.Zoom;
imageBox.Height = 400;
imageBox.BorderStyle = BorderStyle.FixedSingle;
var imageLabel = new Label();
imageLabel.Text = item.Name;
imageLabel.Dock = DockStyle.Top;
imageLabel.TextAlign = ContentAlignment.MiddleCenter;
panelFiles.Controls.Add(imageLabel);
panelFiles.Refresh();
}
@ -99,13 +119,13 @@ namespace WinFormsApp
if (dialog.ShowDialog() == DialogResult.OK)
{
_filename = dialog.FileName;
labelFile.Text = System.IO.Path.GetDirectoryName(_filename);
labelFile.Text = System.IO.Path.GetFileName(_filename);
}
}
private void FormMediaFiles_Resize(object sender, EventArgs e)
{
panelFiles.Width = Convert.ToInt32(this.Width * 0.5);
groupBoxFiles.Width = Convert.ToInt32(this.Width * 0.4);
panelFiles.Height = this.Height;
foreach (var control in this.Controls.OfType<PictureBox>())
{