using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using PXP.Crawler.API.Model;

namespace PXP.Crawler.API.Plugins.Utils
{
    
    [NodeInfo("Alert", typeof(AlertNode), Category = "Utils",
        DefaultWidth = 80, DefaultHeight = 40, LockSize = true)]
    public class AlertNode : Node
    {
        public AlertNode(Program program) : base(program)
        {
        }

        public override void CreateDesigner()
        {
            base.CreateDesigner();
            designer.Control.BackColor = Color.Indigo;
        }

        private string title = "Alert";

        [NodeSerializeProperty]
        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        private string msg = "";

        [NodePin(NodePin.NodePinDirection.Input)]
        public string Message
        {
            get { return msg; }
            set
            {
                if (msg != value)
                {
                    msg = value;
                }
            }
        }

        private bool show = false;

        [NodePin(NodePin.NodePinDirection.Input)]
        public bool Show
        {
            get
            {
                return false;
            }
            set
            {
                if (value)
                {
                    XtraMessageBox.Show(title, msg);
                }
            }
        }
    }
}
