using System;
using System.Windows;
using System.Windows.Markup;
using QFDT_Components;
using QRCT_modem_RF_Debug_tool;

namespace QFDT;

public partial class Product_Configuration : Window, IComponentConnector
{
	public delegate void ExitDialog();

	public ExitDialog FireCloseEvent;

	public Product_Configuration(string PCF_Path)
	{
		InitializeComponent();
		pCF_Wizard1.ProductConfigurationFolder = PCF_Path;
		base.Title = "Product Configuration (NEW)";
		pCF_Wizard1.AddNewProductCreated(NewProductCreated);
	}

	public Product_Configuration(string PCF_Path, PCF pcf, string ProductName)
	{
		InitializeComponent();
		pCF_Wizard1.EditMode = PCF_Wizard.EditModeEnum.Edit;
		pCF_Wizard1.ProductConfigurationFolder = PCF_Path;
		pCF_Wizard1.SetupPCF(pcf, ProductName);
		base.Title = "Product Configuration (EDIT)";
		pCF_Wizard1.AddNewProductCreated(NewProductCreated);
	}

	public void NewProductCreated()
	{
		Close();
	}

	private void OnClosed(object sender, EventArgs e)
	{
		if (FireCloseEvent != null)
		{
			FireCloseEvent();
		}
	}

	public void AddExitDialog(ExitDialog me)
	{
		FireCloseEvent();
	}
}
