using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Xml;

namespace QCLVR;

[ComVisible(true)]
public class COMclass
{
	private MainWindow owner;

	private XmlNodeList TestCollection;

	public void WebClick(int source)
	{
		int num = source - 1;
		if (num < TestCollection.Count && num >= 0)
		{
			string innerXml = TestCollection[num].InnerXml;
			WebBrowser webB = owner.WebB;
			object[] args = new string[2]
			{
				innerXml,
				source.ToString()
			};
			webB.InvokeScript("DemandLoad", args);
		}
		else
		{
			MessageBox.Show("Something went wrong. Data file was empty!");
		}
	}

	public COMclass(MainWindow owner, string filepath)
	{
		this.owner = owner;
		XmlDocument xmlDocument = new XmlDocument();
		xmlDocument.Load(filepath);
		TestCollection = xmlDocument.GetElementsByTagName("div");
	}
}
