using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PXP.Crawler.API.Designers.Controls;

namespace PXP.Crawler.API.Plugins.Net.Chrome.Controls
{
    public partial class ChromeControl : ContainerControlEx
    {
        public ChromeControl()
        {
            InitializeComponent();
            base.Dock = DockStyle.Fill;    
        }

        internal ChromeNode chromeNode;

        public ChromeControl(ChromeNode cNode)
        {
            InitializeComponent();
            base.Dock = DockStyle.Fill;
            chromeNode = cNode;
        }

        private void ChromeControl_Load(object sender, EventArgs e)
        {
            
        }

        private void webBrowser_Navigated(object sender, Skybound.Gecko.GeckoNavigatedEventArgs e)
        {
        }

        private void webBrowser_DocumentCompleted(object sender, EventArgs e)
        {
            chromeNode.docLoaded = true;
            chromeNode.NotifyPropertyChange("DocumentLoaded");
            chromeNode.docLoaded = false;
            chromeNode.NotifyPropertyChange("Chrome");
        }

        private void webBrowser_Alert(object sender, Skybound.Gecko.WindowAlertEventArgs e)
        {
            MessageBox.Show(e.Title, e.Message);
        }
    }
}
