using System;
using System.Windows.Forms;

namespace DDUtilityApp.MESDOWNLOADER
{
    public partial class ProgressForm : Form
    {
        public ProgressForm(int maxFiles)
        {
            InitializeComponent();
            progressBar.Maximum = maxFiles + 1;
            lblStatus.Text = string.Empty;
        }

        public void UpdateProgress(string fileName, int current)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Action(() => UpdateProgress(fileName, current)));
            }
            else
            {
                lblStatus.Text = $"{fileName}\r\n{current} / {progressBar.Maximum - 1}";
                progressBar.Value = current;
            }
        }
    }
}
