using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace GcDevicePc
{
    public partial class StartWin : Form
    {
        private int searchsec = 0;
        private int i = 0;


        public StartWin()
        {
            InitializeComponent();
        }

        private void checkhmitimer_Tick(object sender, EventArgs e)
        {
            searchsec++;

            if(globaldata.StartNetwork)
            { 
                if (!String.IsNullOrEmpty(globaldata.connection_ip))
                {
                    this.Close();
                }
                else
                {
                    this.searchinfo.Text = "设备搜索中";
                    for (i = 0; i < (searchsec % 4); i++)
                    {
                        this.searchinfo.Text += ".";
                    }

                }
            }
            else
            {
                this.searchinfo.Text = "本机网络未就绪";
                for (i = 0; i < (searchsec % 4); i++)
                {
                    this.searchinfo.Text += ".";
                }
            }

            if (globaldata.OffLinkMode)
            {
                this.Close();
            }
        }

        private void offline_Click(object sender, EventArgs e)
        {
            globaldata.OffLinkMode = true;
        }
    }
}
