using MesControl;
using MQTTnet;
using MQTTnet.Client.Connecting;
using MQTTnet.Client.Disconnecting;
using MQTTnet.Client.Receiving;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Windows.Forms;
//using SystemFramework;

namespace MisDataName
{
    public partial class SecondForm : Form
    {
        public SecondForm()
        {
            InitializeComponent();
            InitFormDynamicControls();
            InitMainSignalEvent();
            //InitOtherFormAction();
            //SyncForm_Init();

            string url;
            string topic;
            url = System.Configuration.ConfigurationManager.AppSettings["MqttUrl"];
            topic = System.Configuration.ConfigurationManager.AppSettings["MqttTargetTopicPLC"];

            //InitMqtt2(url, topic);

        }

        
        
        
        //void WriteWorkStationSignal(string OpName,string SignalName,bool value)
        //{
        //    try
        //    { 
        //        if (Array.IndexOf(SignalNames, "TagType_"+SignalName)!=-1)
        //        {
        //            PlcWorkStationSignal plcWorkStationSignal = (PlcWorkStationSignal)Controls.Find("plcWorkStationSignal_" + OpName, true)[0];
        //            plcWorkStationSignal.SignalChange("TagType_"+SignalName, value);
        //            if (SignalName=="14")
        //            {
        //                WorkStation_RefreshWorkStationStatus(OpName, value);
        //            }

        //        }
        //    }
        //    catch (Exception err)
        //    {
        //        //ApplicationLog.WriteLog(err, err.Message);
        //    }

        //}
        

        private void SecondForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            { 
                 this.Dispose();
            }
            catch (Exception err)
            {
                //ApplicationLog.WriteLog(err, err.Message);
            }
        }
    }

    class MyPanel : Panel
    {
        public MyPanel()
        {
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
        }
    }
}
