using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using GcDevicePc.CK_UI;
using GcDevicePc.Common;
using GcDevicePc.IniParam;

namespace GcDevicePc
{
    public partial class Formdebug : Form
    {
        //CurveDisPlay cuidisp = new CurveDisPlay();//显示波形
        CurveDisPlay curdisplay = new CurveDisPlay();
        CurveDisPlay2 curdisplay2 = new CurveDisPlay2();
        CurveDisPlay3 curdisplay3 = new CurveDisPlay3();

        DataState dataleft = new DataState();//状态显示
        
        public Formdebug()
        {
            InitializeComponent();
        }

        private void Formdebug_Load(object sender, EventArgs e) 
        {
            loadPanel();
        }
        private void loadPanel()  //加载界面
        {
            //this.dockPanel1.Contains(curdisplay);
            //curdisplay.Show(this.dockPanel1);
            //curdisplay.CloseButtonVisible = false;

            Load_Win();

            dataleft.Show(this.dockPanel1,DockState.DockRight);
            dataleft.CloseButtonVisible = false;
            //dataleft.Close_Threading();
            //dataleft.Close();
        }

        private void Load_Win()
        {

            if (!String.IsNullOrEmpty(globaldata.connection_ip))
            {

                if (CProfileDevice.m_DevParam.syspara.u16DetFront == 1)
                {
                    curdisplay.Text = "前检测器";
                }

                if (CProfileDevice.m_DevParam.syspara.u16DetInter == 1)
                {
                    curdisplay2.Text = "中检测器";
                }

                if (CProfileDevice.m_DevParam.syspara.u16DetBehind == 1)
                {
                    curdisplay3.Text = "后检测器";
                }

            }
            else
            {

                if (CProfileDevice.m_DevParam.syspara.u16DetFront == 1)
                {
                    curdisplay.Text = "前检测器";
                }

                if (CProfileDevice.m_DevParam.syspara.u16DetInter == 1)
                {
                    curdisplay2.Text = "中检测器";
                }

                if (CProfileDevice.m_DevParam.syspara.u16DetBehind == 1)
                {
                    curdisplay3.Text = "后检测器";
                }
            }



            if (CProfileDevice.m_DevParam.syspara.u16DetFront == 1)
            {
                this.dockPanel1.Contains(curdisplay);
                curdisplay.Show(this.dockPanel1);
                curdisplay.CloseButtonVisible = false;
            }
            else
            {
                curdisplay.Dispose();
            }

            if (CProfileDevice.m_DevParam.syspara.u16DetInter == 1)
            {
                this.dockPanel1.Contains(curdisplay2);
                curdisplay2.Show(this.dockPanel1);
                curdisplay2.CloseButtonVisible = false;
            }
            else
            {
                curdisplay2.Dispose();
            }

            if (CProfileDevice.m_DevParam.syspara.u16DetBehind == 1)
            {
                this.dockPanel1.Contains(curdisplay3);
                curdisplay3.Show(this.dockPanel1);
                curdisplay3.CloseButtonVisible = false;
            }
            else
            {
                curdisplay3.Dispose();
            }

            //Start_Thread();

            //dockPanelSideLeft.Show(this.dockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.DockRight);
            //dockPanelSideLeft.CloseButtonVisible = false;

        }

        public void CloseThread()
        {
            try
            {
                dataleft.Close_Threading();
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
            }
        }
    }
}
