using System.Windows.Forms;
using QCRPG.Framework;

namespace QCRPG.TSL.NFC;

public class NFCFirmwarePatchProgressHandler : IObserver<int>
{
	private ToolStripProgressBar progressBar;

	public NFCFirmwarePatchProgressHandler(ToolStripProgressBar progressBar)
	{
		this.progressBar = progressBar;
		progressBar.Minimum = 0;
		progressBar.Maximum = 100;
	}

	public void NotifyObserver(int percentComplete)
	{
		progressBar.GetCurrentParent().BeginInvoke((MethodInvoker)delegate
		{
			progressBar.Value = percentComplete;
		});
	}
}
