using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using MESClassLibrary.BLL.Log;
using PunchAndWeld.DataSouce;

namespace PunchAndWeld
{
    public partial class FrmPreNoPlan : Form
    {
        public FrmPreNoPlan()
        {
            InitializeComponent();
        }

        private void FrmPreNoPlan_Load(object sender, EventArgs e)
        {
            string stationNo = ConfigurationManager.AppSettings["StationNo"];
            label1.Text = ProScreenFunc.GetStation(stationNo);
            Control.CheckForIllegalCrossThreadCalls = false;

            Thread t = new Thread(new ThreadStart(TimeGo));
            t.Start();

            textBox1.TabIndex = 0;
            textBox2.Enabled = false;
            button3.Enabled = ConfigurationManager.AppSettings["PrintEnable"].ToLower() == "true" ? true : false;
        }

        private void TimeGo()
        {
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval = 10;
            timer.Enabled = true;
            timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Tick);
        }

        private void timer_Tick(object sender, EventArgs e)
        {
            label9.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            Thread.Sleep(500);
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {

                }
            }
            catch (Exception ex)
            {
                LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
            }
        }

    }
}