using GcDevicePc.ConfigMethod;
using GcDevicePc.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GcDevicePc
{
    public partial class TestForm : Form
    {
        public TestForm()
        {
            InitializeComponent();
            //bgWorker.DoWork += BgWorker_DoWork;
            //title.Show();

            //bgWorker.RunWorkerCompleted += BgWorker_RunWorkerCompleted;
        }
        //GCTitle title = new GCTitle();

        BackgroundWorker bgWorker = new BackgroundWorker();
        PrompBox loadingCtl = new PrompBox(162, true);//定义加载控件
        private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
        {

            System.Threading.Thread.Sleep(3000);

        }

        private void BgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            loadingCtl.Hide();

        }
        Form1 form1;

        private void btnShow_Click(object sender, EventArgs e)
        {
            //loadingCtl.TipsInfo = "提示信息";
            ////显示加载动画
            //loadingCtl.ShowLoading(this);
            //Application.DoEvents();
            //bgWorker.RunWorkerAsync();

            //this.pictureMenu1.PMOptbtnstatus = 3;
            //(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 4;
            //kailiang

            if (form1 == null)
            {
                form1 = new Form1("asdasdasdsa");
                form1.Show();

            }
            else if(form1.IsDisposed)
            {
                form1 = new Form1("asdasdasdsa");
                form1.Show();
            }
            else
            {
                form1.Activate();
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("asd");
            //this.pictureMenu1.PMOptbtnstatus = 4;
            //(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3;
            //tinfliang
            if (form1 == null)
            {
                form1 = new Form1(1111);
                form1.Show();

            }
            else if (form1.IsDisposed)
            {
                form1 = new Form1(1111);
                form1.Show();
            }
            else
            {
                form1.Activate();
            }
        }
    }
}
