RFIDClient

14 篇文章 0 订阅

/*******************************************
 * 出樓層的GateDoor
 * *****************************************/
using System;
using System.Threading;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Text;
using RFIDClient2._0;
using System.Xml;
using System.Xml.XPath;
using RFIDClient.Common;
using RFIDClient.Common.Utilities;
using System.Data.SqlClient;
using System.Diagnostics;

using RFIDClient.Data;
using RFIDClient.Dal;

using UtilitiesModules.Common.Utilities.Log;

using System.Runtime.InteropServices;//Add By XKH 2009-05-04

namespace RFIDClient
{
    /// <summary>
    /// Summary description for RFIDTestClient.
    /// </summary>
    public class RFIDFloor : Form
    {
        #region Private
        private System.ComponentModel.IContainer components;
        private TextBox bTextBox_M1;
        private Button cmdCloseConnection;
        private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
        protected System.Data.SqlClient.SqlTransaction Tran;
        protected System.Data.SqlClient.SqlTransaction SPTran;
        private RFIDClient2._0.CommandControler CommandControler;
        private RFIDClient2._0.GetProfileInfo GetProfileInfo;
        private System.Data.DataTable DtSelectItem;
        private DataGrid DgSelect;
        private Button cmdcancel;
        private System.Data.DataSet DsSelectItem;
        private XmlNode root;
        private XmlNodeList nodeList;
        private DataGrid DgResult;
        private System.Windows.Forms.Label lblcomreq;
        private System.Windows.Forms.Label lblresult;
        private XmlDocument doc;
        public string loginResult, username, psd, strCurIP, strServerIP;
        private System.Windows.Forms.GroupBox groupBox1;
        private Label bLabel1;
        private TextBox txtTotal;
        private System.Windows.Forms.Timer timer1;
        private RFIDClient.Common.Utilities.DBMethod DBMethod;
        private RFIDClient.Common.Utilities.CDBMiddlewareMethod DBMiddlewareMethod;
        private ArrayList TagIDList = new ArrayList();
        private ArrayList CounterList = new ArrayList();
        private Hashtable FilteringParaHT, ReadCountHT, WakeUpHT, MultiRecordHT;
        private System.Windows.Forms.Timer timer2;
        private int intFilteringParameter, intReadingFrequency, intWakeUpCount;
        private int labelcounter = 0;
        //private int intwritetagcount = 24;
        private DataTable dtResult;
        private Button cmdstart;
        private Button cmdlogin;
        private Button cmdDelete;
        private DataTable dtTagLife;
        private System.Windows.Forms.Timer timer3;
        private RFIDClient.Common.Utilities.CPubMethod PubMethod;
        private bool boolLogin = false;
        private bool blWriteSuccessfully = false;
        private char[] delimiter = new char[] { ' ' };
        private System.Windows.Forms.ContextMenu contextMenu1;
        private System.Windows.Forms.MenuItem menuItem1;
        private string strProcessingType = "";
        //private string stroldwritetagid = "";
        //private string strMultiRecord = "Y";
        private string strlang = "English";
        private System.Windows.Forms.NotifyIcon notifyIcon1;
        private Label lblAllRight;
        private System.Windows.Forms.ContextMenu NotifyIconContextMenu;
        private System.Windows.Forms.MenuItem menuRestore;
        private System.Windows.Forms.MenuItem menuClose;
        private CheckBox cbDisplayResult;
        private CheckBox cbDisplayResult2;
        private PictureBox pictureBox1;
        private ComboBox cboServerIP;
        private Button cmdadd;
        private Label lblMode;
        private Label lblANtSeq;
        private TextBox txtAntSeq;
        private Label lblReaderIP;
        private Label lblaction;
        private ComboBox cboMode;
        private Label lblport;
        private TextBox txtport;
        private Label lblSIP;
        private Button cmdExternalOutput;
        private ComboBox cboReaderIP;
        private ComboBox cboAction;
        private GroupBox ActionBox;
        private Button bImageButton1;
        private Button bExitButton1;
        private TextBox txtTimeOut;
        private Label lblFilteringPara;
        private Label lblReadingFreq;
        private TextBox txtReadingFreq;
        private Label bLabel2;
        private TextBox txtWakeUPCount;
        private Label lblrfattenuation;
        private TextBox txtrfattenuation;
        private Label lblwritetagAnt;
        private TextBox txtwritetagAtt;
        private GroupBox groupBox3;
        private TextBox txtCurrentDateTime;
        private Label lblconnecting;
        private TabControl tabControl1;
        private TabPage tabPage1;
        private TabPage tabPage2;
        private Label lblTagNo;
        private Label lblAlertMSG;
        private Label lblStatus;
        private Label lblCartonQty;
        private Label lblJobNo;
        private PictureBox pitLogo;
        private ArrayList ALServerIP;
        private Label LblMainInterface;
        private TextBox TxtMainInterface;
        private TextBox TxtMultiTag;
        private Label LblMultiTag;
        private TextBox TxtSingleTagRead;
        private Label LblSingleTagRead;
        // ***********************************
        // Modified

        // The no. of second to return to main interface - Leo Logo
        private bool isStartCountdown = false;
        private DateTime dtCountdown = DateTime.Now;
        private DataTable dtjobNo = new DataTable();

        private bool isStartCountdownMulitTag = false;
        private DateTime dtMultiTagNo = DateTime.Now;
        private string strCurrentJobNo = string.Empty;
        private string strCurrentTagNo = string.Empty;
        private int intCurrentInterface = -1;

        /// <summary>
        /// 标签前几位
        /// </summary>
        private string PrexTagNo = ""; //Add By XueKeHuang 2008-10-31

        private string strAutoLogin = "";//by Eric 23/1/2007 Check autologin or not

        //*****************************************************************************************
        // Description :處理讀取Tag信息的資料提取

 

        // Modified at 1/03/2007
        private DateTime dtHandleprevious = DateTime.Now;
        //*****************************************************************************************

        //*****************************************************************************************
        // Description :                  It is used to limit the times to submit output signal
        // Modified at 12/01/2007
        private bool isStartSetOutputSignal = false;
        private DateTime dtAnySignal = DateTime.Now;
        private bool isBeep = false;
        private bool isRed = false;
        private bool isAmber = false;
        private bool isGreen = false;
        private readonly int intCountdownInterval = 500;
        private readonly int intTimer2Interval = 650;
        private System.Windows.Forms.Timer timer4;
        private Label lblcollectstate;
        private int lblLocationCount = 0;
        private readonly int intWaitOutputSignalInterval = 1000;
        //*****************************************************************************************

        //*****************************************************************************************
        // Description :                 New Classes
        // Modified at 07/08/2007
        private TagReceivedList trTagLife;
        private System.Windows.Forms.Timer CountdownTimer;
        private System.Windows.Forms.Timer timer5;
        private Label lbl1;
        private JobNoFloorList JobNoList;
        //*****************************************************************************************


        private WriteLog writeLog;//Added By XKH 2009-03-02
        private string TagNo1;//Added By XKH 2009-03-04
        private string TagNo2;//Added By XKH 2009-03-04


        private DateTime dBeginTime; //Add By XKH 2009-03-20
        private DateTime dEndTime;
        private Label lblVersion;
        private Label lblDBCount;
        private Label lblTagCount; //Add By XKH 2009-03-20

        private bool isSaveKeepLog = false;//Added By Berlin 8/4/2009是否要保存Keep Log

        private NetLog netLog;
        private Panel plInputTagNo;
        private Button btnYes;
        private TextBox txtcTagNo;
        private Label label1;//Add By XKH 2009-05-04
        private int countNetTime;//Add By XKH 2009-05-04

        private bool IsInput = false;//Add By XKH 2009-07-30
        private string strInputTagNo = "";//Add By XKH 2009-07-30

        #endregion

        #region Property

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>


        // Method :                       GetFilteringInterval
        // Description :                  It is used to get the value of filtering interval.
        // Input :                            null
        // Output :                         int
        private int GetFilteringInterval() //获取超时的时间间隔
        {
            int result = 10;
            try
            {
                result = int.Parse(this.txtTimeOut.Text.Trim());
            }
            catch
            {
                result = 10;
            }
            return result;
        }


        // Method :                       GetMainInterfaceInterval
        // Description :                  It is used to get the time of interval to return to main interface
        // Input :                            null
        // Output :                         int
        private int GetMainInterfaceInterval() //获取主要界面的时间间隔
        {
            int result = 5;
            try
            {
                result = int.Parse(this.TxtMainInterface.Text.Trim());
            }
            catch
            {
                result = 5;
            }
            return result;
        }


        // Method :                       GetMultiTagTime
        // Description :                  It is used to get the time of interval to display all tag that
        //                                      is detected for a long time
        // Input :                            null
        // Output :                         int
        private int GetMultiTagTime()  //获取长期探测的全部标签显示的时间间隔
        {
            int result = 5;
            try
            {
                result = int.Parse(this.TxtMultiTag.Text.Trim());
            }
            catch
            {
                result = 5;
            }
            return result;
        }

        // Method :                       GetSingleTagTime
        // Description :                  It is used to get the time of interval to display one tag that
        //                                      is detected for a long time
        // Input :                            null
        // Output :                         int
        private int GetSingleTagTime()//获取长期探测的单个标签显示的时间间隔
        {
            int result = 5;
            try
            {
                result = int.Parse(this.TxtSingleTagRead.Text.Trim());
            }
            catch
            {
                result = 5;
            }
            return result;
        }

        #endregion

        //<<<<<<<<<<<<<<<<<<<<<Add By XKH 2009-05-04 Begin
        [DllImport("wininet.dll")]
        private extern static bool InternetGetConnectedState(out int connectionDescription, int reservedValue);
        //>>>>>>>>>>>>>>>>>>>>>End

        public RFIDFloor(string username, string psd, string strServerIP, ArrayList strArrServerIP, string strlang, string strAutoLogin)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            this.strCurIP = GetCurrentIP.GetLocalIP();//获取客户端的IP地址
            this.username = username;
            this.psd = psd;
            this.strlang = strlang;
            this.strServerIP = strServerIP;
            this.ALServerIP = new ArrayList();
            this.ALServerIP = strArrServerIP;
            this.loginprogress(this.strServerIP);
            this.notifyIcon1.Text = RFIDClient.ProcessProfile.ReadConfig.GetAppName();
            this.strAutoLogin = strAutoLogin;

            this.trTagLife = new TagReceivedList();
            this.JobNoList = new JobNoFloorList();

            this.writeLog = new WriteLog(username);//Add By XKH 2009-03-02
            this.TagNo1 = "";//Add By XKH 2009-03-04
            this.TagNo2 = "";//Add By XKH 2009-03-04

            this.lblVersion.Text = "版本:" + Application.ProductVersion;//Added By Berlin 9/4/2009

            IsStartTime2();//Add By XKH 2009-07-30
        }


        //<<<<<<<<<<<<<<<<<<<<<<<<By XKH 2009-07-30 Begin
        private void IsStartTime2()  //
        {
            if (Convert.ToBoolean(Common.Utilities.Common.getIsInput()))
            {
                this.plInputTagNo.Visible = true;
                IsInput = true;
                this.timer2.Start();
            }
            else
            {
                this.plInputTagNo.Visible = false;
            }
        }

        private void btnYes_Click(object sender, EventArgs e)
        {
            if (IsCheckNull())
                return;

            this.strInputTagNo = this.txtcTagNo.Text.ToString().Trim().ToUpper();
        }

        private bool IsCheckNull()
        {
            if (this.txtcTagNo.Text.Trim().Length == 0)
            {
                MessageBox.Show("請輸入標簽No", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                return true;
            }

            if (this.txtcTagNo.Text.Trim().Substring(0, 2).ToUpper() != "AA" && this.txtcTagNo.Text.Trim().Substring(0, 2).ToUpper() != "BB" && this.txtcTagNo.Text.Trim().Substring(0, 2).ToUpper() != "CC")
            {
                MessageBox.Show("輸入的標簽No不是AA或BB或CC!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                return true;
            }

            return false;
        }

        /// <summary>
        /// 处理输入的标签
        /// </summary>
        private void HandleInputTag()
        {
            CDBSPMethed CDBSPMethod = null;
            lblcollectstate.Text = "數據正在處理中...";

            this.lblcollectstate.ForeColor = System.Drawing.Color.Red;

            if (strInputTagNo.Trim().Length == 0)
                return;

            PrexTagNo = strInputTagNo.Substring(0, 2).ToUpper();

            if (CDBSPMethod == null)
            {
                if (PrexTagNo.ToString().Trim() == "CC")  //标签的前两位为CC,则创对象。
                    CDBSPMethod = new CDBSPMethed("LEMSDB");
                else
                    CDBSPMethod = new CDBSPMethed();
            }

            this.DisplayByTagID(strInputTagNo, CDBSPMethod);

            this.strInputTagNo = "";

        }

        //>>>>>>>>>>>>>>>>>>>>>End

        //<<<<<<<<<<<<<<<<<<Add By XKH 2009-05-04 Begin
        /// <summary>
        /// 判断网络是否连接成功,连接成功则True
        /// </summary>
        /// <returns></returns>
        private bool IsConnected()
        {
            int I = 0;
            bool state = InternetGetConnectedState(out I, 0);
            return state;
        }

        /// <summary>
        /// 检测网络
        /// </summary>
        private void CheckNet()
        {
            netLog = new NetLog();

            if (!IsConnected())
            {
                if (countNetTime == 0)
                {
                    string strMessage = "[" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "]" + " 網絡斷開連接!";
                    netLog.WriteNetLog(strMessage, "Internet");
                    countNetTime = 1;
                }
            }
            else
            {
                countNetTime = 0;
            }

        }
        //>>>>>>>>>>>>>>>>>>End

        /// <summary>
        /// 清除对象空间
        /// </summary>
        /// <param name="disposing"></param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

 

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RFIDFloor));
            this.bTextBox_M1 = new System.Windows.Forms.TextBox();
            this.contextMenu1 = new System.Windows.Forms.ContextMenu();
            this.menuItem1 = new System.Windows.Forms.MenuItem();
            this.cmdCloseConnection = new System.Windows.Forms.Button();
            this.DgSelect = new System.Windows.Forms.DataGrid();
            this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
            this.cmdcancel = new System.Windows.Forms.Button();
            this.DgResult = new System.Windows.Forms.DataGrid();
            this.lblcomreq = new System.Windows.Forms.Label();
            this.lblresult = new System.Windows.Forms.Label();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.cbDisplayResult2 = new System.Windows.Forms.CheckBox();
            this.cmdDelete = new System.Windows.Forms.Button();
            this.txtTotal = new System.Windows.Forms.TextBox();
            this.bLabel1 = new System.Windows.Forms.Label();
            this.cbDisplayResult = new System.Windows.Forms.CheckBox();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.timer2 = new System.Windows.Forms.Timer(this.components);
            this.cmdstart = new System.Windows.Forms.Button();
            this.cmdlogin = new System.Windows.Forms.Button();
            this.timer3 = new System.Windows.Forms.Timer(this.components);
            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
            this.NotifyIconContextMenu = new System.Windows.Forms.ContextMenu();
            this.menuRestore = new System.Windows.Forms.MenuItem();
            this.menuClose = new System.Windows.Forms.MenuItem();
            this.lblAllRight = new System.Windows.Forms.Label();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.cboServerIP = new System.Windows.Forms.ComboBox();
            this.cmdadd = new System.Windows.Forms.Button();
            this.lblMode = new System.Windows.Forms.Label();
            this.lblANtSeq = new System.Windows.Forms.Label();
            this.txtAntSeq = new System.Windows.Forms.TextBox();
            this.lblReaderIP = new System.Windows.Forms.Label();
            this.lblaction = new System.Windows.Forms.Label();
            this.cboMode = new System.Windows.Forms.ComboBox();
            this.lblport = new System.Windows.Forms.Label();
            this.txtport = new System.Windows.Forms.TextBox();
            this.lblSIP = new System.Windows.Forms.Label();
            this.cmdExternalOutput = new System.Windows.Forms.Button();
            this.cboReaderIP = new System.Windows.Forms.ComboBox();
            this.cboAction = new System.Windows.Forms.ComboBox();
            this.ActionBox = new System.Windows.Forms.GroupBox();
            this.bImageButton1 = new System.Windows.Forms.Button();
            this.bExitButton1 = new System.Windows.Forms.Button();
            this.txtTimeOut = new System.Windows.Forms.TextBox();
            this.lblFilteringPara = new System.Windows.Forms.Label();
            this.lblReadingFreq = new System.Windows.Forms.Label();
            this.txtReadingFreq = new System.Windows.Forms.TextBox();
            this.bLabel2 = new System.Windows.Forms.Label();
            this.txtWakeUPCount = new System.Windows.Forms.TextBox();
            this.lblrfattenuation = new System.Windows.Forms.Label();
            this.txtrfattenuation = new System.Windows.Forms.TextBox();
            this.lblwritetagAnt = new System.Windows.Forms.Label();
            this.txtwritetagAtt = new System.Windows.Forms.TextBox();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.TxtSingleTagRead = new System.Windows.Forms.TextBox();
            this.LblSingleTagRead = new System.Windows.Forms.Label();
            this.TxtMultiTag = new System.Windows.Forms.TextBox();
            this.LblMultiTag = new System.Windows.Forms.Label();
            this.TxtMainInterface = new System.Windows.Forms.TextBox();
            this.LblMainInterface = new System.Windows.Forms.Label();
            this.txtCurrentDateTime = new System.Windows.Forms.TextBox();
            this.lblconnecting = new System.Windows.Forms.Label();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.plInputTagNo = new System.Windows.Forms.Panel();
            this.btnYes = new System.Windows.Forms.Button();
            this.txtcTagNo = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.lblDBCount = new System.Windows.Forms.Label();
            this.lblTagCount = new System.Windows.Forms.Label();
            this.lblTagNo = new System.Windows.Forms.Label();
            this.lblAlertMSG = new System.Windows.Forms.Label();
            this.lblStatus = new System.Windows.Forms.Label();
            this.lblCartonQty = new System.Windows.Forms.Label();
            this.lblJobNo = new System.Windows.Forms.Label();
            this.pitLogo = new System.Windows.Forms.PictureBox();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.lblVersion = new System.Windows.Forms.Label();
            this.lbl1 = new System.Windows.Forms.Label();
            this.timer4 = new System.Windows.Forms.Timer(this.components);
            this.lblcollectstate = new System.Windows.Forms.Label();
            this.CountdownTimer = new System.Windows.Forms.Timer(this.components);
            this.timer5 = new System.Windows.Forms.Timer(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.DgSelect)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.DgResult)).BeginInit();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            this.ActionBox.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.plInputTagNo.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pitLogo)).BeginInit();
            this.tabPage2.SuspendLayout();
            this.SuspendLayout();
            //
            // bTextBox_M1
            //
            this.bTextBox_M1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)));
            this.bTextBox_M1.BackColor = System.Drawing.Color.White;
            this.bTextBox_M1.ContextMenu = this.contextMenu1;
            this.bTextBox_M1.Font = new System.Drawing.Font("Verdana", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.bTextBox_M1.Location = new System.Drawing.Point(657, 28);
            this.bTextBox_M1.Multiline = true;
            this.bTextBox_M1.Name = "bTextBox_M1";
            this.bTextBox_M1.ReadOnly = true;
            this.bTextBox_M1.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            this.bTextBox_M1.Size = new System.Drawing.Size(167, 264);
            this.bTextBox_M1.TabIndex = 14;
            this.bTextBox_M1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.bTextBox_M1_MouseClick);
            //
            // contextMenu1
            //
            this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem1});
            //
            // menuItem1
            //
            this.menuItem1.Index = 0;
            this.menuItem1.Text = "Clear";
            this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
            //
            // cmdCloseConnection
            //
            this.cmdCloseConnection.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cmdCloseConnection.Location = new System.Drawing.Point(764, 145);
            this.cmdCloseConnection.Name = "cmdCloseConnection";
            this.cmdCloseConnection.Size = new System.Drawing.Size(91, 23);
            this.cmdCloseConnection.TabIndex = 15;
            this.cmdCloseConnection.Text = "Disconnect";
            this.cmdCloseConnection.Click += new System.EventHandler(this.cmdCloseConnection_Click);
            //
            // DgSelect
            //
            this.DgSelect.AlternatingBackColor = System.Drawing.Color.Lavender;
            this.DgSelect.BackColor = System.Drawing.Color.WhiteSmoke;
            this.DgSelect.BackgroundColor = System.Drawing.Color.LightGray;
            this.DgSelect.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.DgSelect.CaptionBackColor = System.Drawing.Color.LightSteelBlue;
            this.DgSelect.CaptionForeColor = System.Drawing.Color.MidnightBlue;
            this.DgSelect.CaptionVisible = false;
            this.DgSelect.DataMember = "";
            this.DgSelect.FlatMode = true;
            this.DgSelect.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.DgSelect.ForeColor = System.Drawing.Color.MidnightBlue;
            this.DgSelect.GridLineColor = System.Drawing.Color.Gainsboro;
            this.DgSelect.GridLineStyle = System.Windows.Forms.DataGridLineStyle.None;
            this.DgSelect.HeaderBackColor = System.Drawing.Color.MidnightBlue;
            this.DgSelect.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
            this.DgSelect.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.DgSelect.LinkColor = System.Drawing.Color.Teal;
            this.DgSelect.Location = new System.Drawing.Point(6, 32);
            this.DgSelect.Name = "DgSelect";
            this.DgSelect.ParentRowsBackColor = System.Drawing.Color.Gainsboro;
            this.DgSelect.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
            this.DgSelect.ReadOnly = true;
            this.DgSelect.RowHeaderWidth = 20;
            this.DgSelect.SelectionBackColor = System.Drawing.Color.CadetBlue;
            this.DgSelect.SelectionForeColor = System.Drawing.Color.WhiteSmoke;
            this.DgSelect.Size = new System.Drawing.Size(640, 104);
            this.DgSelect.TabIndex = 18;
            this.DgSelect.TableStyles.AddRange(new System.Windows.Forms.DataGridTableStyle[] {
            this.dataGridTableStyle1});
            this.DgSelect.MouseClick += new System.Windows.Forms.MouseEventHandler(this.DgSelect_MouseClick);
            //
            // dataGridTableStyle1
            //
            this.dataGridTableStyle1.DataGrid = this.DgSelect;
            this.dataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            //
            // cmdcancel
            //
            this.cmdcancel.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cmdcancel.Location = new System.Drawing.Point(764, 124);
            this.cmdcancel.Name = "cmdcancel";
            this.cmdcancel.Size = new System.Drawing.Size(91, 23);
            this.cmdcancel.TabIndex = 20;
            this.cmdcancel.Text = "Cancel";
            this.cmdcancel.Click += new System.EventHandler(this.cmdcancel_Click);
            //
            // DgResult
            //
            this.DgResult.AlternatingBackColor = System.Drawing.Color.Lavender;
            this.DgResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)));
            this.DgResult.BackColor = System.Drawing.Color.WhiteSmoke;
            this.DgResult.BackgroundColor = System.Drawing.Color.LightGray;
            this.DgResult.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.DgResult.CaptionBackColor = System.Drawing.Color.LightSteelBlue;
            this.DgResult.CaptionForeColor = System.Drawing.Color.MidnightBlue;
            this.DgResult.CaptionVisible = false;
            this.DgResult.DataMember = "";
            this.DgResult.FlatMode = true;
            this.DgResult.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.DgResult.ForeColor = System.Drawing.Color.MidnightBlue;
            this.DgResult.GridLineColor = System.Drawing.Color.Gainsboro;
            this.DgResult.GridLineStyle = System.Windows.Forms.DataGridLineStyle.None;
            this.DgResult.HeaderBackColor = System.Drawing.Color.MidnightBlue;
            this.DgResult.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
            this.DgResult.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.DgResult.LinkColor = System.Drawing.Color.Teal;
            this.DgResult.Location = new System.Drawing.Point(6, 168);
            this.DgResult.Name = "DgResult";
            this.DgResult.ParentRowsBackColor = System.Drawing.Color.Gainsboro;
            this.DgResult.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
            this.DgResult.ReadOnly = true;
            this.DgResult.RowHeaderWidth = 20;
            this.DgResult.SelectionBackColor = System.Drawing.Color.CadetBlue;
            this.DgResult.SelectionForeColor = System.Drawing.Color.WhiteSmoke;
            this.DgResult.Size = new System.Drawing.Size(634, 121);
            this.DgResult.TabIndex = 21;
            this.DgResult.MouseClick += new System.Windows.Forms.MouseEventHandler(this.DgResult_MouseClick);
            //
            // lblcomreq
            //
            this.lblcomreq.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblcomreq.Location = new System.Drawing.Point(6, 16);
            this.lblcomreq.Name = "lblcomreq";
            this.lblcomreq.Size = new System.Drawing.Size(135, 16);
            this.lblcomreq.TabIndex = 22;
            this.lblcomreq.Text = "Command Request:";
            //
            // lblresult
            //
            this.lblresult.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblresult.Location = new System.Drawing.Point(657, 12);
            this.lblresult.Name = "lblresult";
            this.lblresult.Size = new System.Drawing.Size(40, 16);
            this.lblresult.TabIndex = 23;
            this.lblresult.Text = "Result: ";
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.cbDisplayResult2);
            this.groupBox1.Controls.Add(this.cmdDelete);
            this.groupBox1.Controls.Add(this.txtTotal);
            this.groupBox1.Controls.Add(this.bLabel1);
            this.groupBox1.Controls.Add(this.lblcomreq);
            this.groupBox1.Controls.Add(this.DgSelect);
            this.groupBox1.Controls.Add(this.DgResult);
            this.groupBox1.Controls.Add(this.bTextBox_M1);
            this.groupBox1.Controls.Add(this.lblresult);
            this.groupBox1.Controls.Add(this.cbDisplayResult);
            this.groupBox1.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.groupBox1.Location = new System.Drawing.Point(14, 344);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(832, 328);
            this.groupBox1.TabIndex = 31;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Command And Result";
            //
            // cbDisplayResult2
            //
            this.cbDisplayResult2.Checked = true;
            this.cbDisplayResult2.CheckState = System.Windows.Forms.CheckState.Checked;
            this.cbDisplayResult2.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cbDisplayResult2.Location = new System.Drawing.Point(697, 12);
            this.cbDisplayResult2.Name = "cbDisplayResult2";
            this.cbDisplayResult2.Size = new System.Drawing.Size(85, 16);
            this.cbDisplayResult2.TabIndex = 67;
            this.cbDisplayResult2.Text = "Display Result";
            this.cbDisplayResult2.Click += new System.EventHandler(this.cbDisplayResult2_Click);
            //
            // cmdDelete
            //
            this.cmdDelete.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cmdDelete.Location = new System.Drawing.Point(6, 139);
            this.cmdDelete.Name = "cmdDelete";
            this.cmdDelete.Size = new System.Drawing.Size(53, 23);
            this.cmdDelete.TabIndex = 26;
            this.cmdDelete.Text = "Delete";
            this.cmdDelete.Click += new System.EventHandler(this.cmdDelete_Click);
            //
            // txtTotal
            //
            this.txtTotal.BackColor = System.Drawing.Color.White;
            this.txtTotal.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtTotal.Location = new System.Drawing.Point(697, 347);
            this.txtTotal.Name = "txtTotal";
            this.txtTotal.Size = new System.Drawing.Size(114, 22);
            this.txtTotal.TabIndex = 25;
            //
            // bLabel1
            //
            this.bLabel1.AutoSize = true;
            this.bLabel1.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.bLabel1.Location = new System.Drawing.Point(662, 355);
            this.bLabel1.Name = "bLabel1";
            this.bLabel1.Size = new System.Drawing.Size(32, 12);
            this.bLabel1.TabIndex = 24;
            this.bLabel1.Text = "Total:";
            //
            // cbDisplayResult
            //
            this.cbDisplayResult.Checked = true;
            this.cbDisplayResult.CheckState = System.Windows.Forms.CheckState.Checked;
            this.cbDisplayResult.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cbDisplayResult.Location = new System.Drawing.Point(63, 144);
            this.cbDisplayResult.Name = "cbDisplayResult";
            this.cbDisplayResult.Size = new System.Drawing.Size(86, 24);
            this.cbDisplayResult.TabIndex = 66;
            this.cbDisplayResult.Text = "Display Result";
            this.cbDisplayResult.Click += new System.EventHandler(this.cbDisplayResult_Click);
            //
            // timer1
            //
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //
            // timer2
            //
            this.timer2.Interval = 650;
            this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
            //
            // cmdstart
            //
            this.cmdstart.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cmdstart.Location = new System.Drawing.Point(764, 104);
            this.cmdstart.Name = "cmdstart";
            this.cmdstart.Size = new System.Drawing.Size(91, 23);
            this.cmdstart.TabIndex = 48;
            this.cmdstart.Text = "Send and Start";
            this.cmdstart.Click += new System.EventHandler(this.bButton1_Click);
            //
            // cmdlogin
            //
            this.cmdlogin.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cmdlogin.Location = new System.Drawing.Point(764, 81);
            this.cmdlogin.Name = "cmdlogin";
            this.cmdlogin.Size = new System.Drawing.Size(91, 23);
            this.cmdlogin.TabIndex = 49;
            this.cmdlogin.Text = "Login";
            this.cmdlogin.Click += new System.EventHandler(this.cmdlogin_Click);
            //
            // timer3
            //
            this.timer3.Interval = 500;
            this.timer3.Tick += new System.EventHandler(this.timer3_Tick);
            //
            // notifyIcon1
            //
            this.notifyIcon1.ContextMenu = this.NotifyIconContextMenu;
            this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
            this.notifyIcon1.Text = "notifyIcon1";
            this.notifyIcon1.Visible = true;
            this.notifyIcon1.DoubleClick += new System.EventHandler(this.notifyIcon1_DoubleClick);
            //
            // NotifyIconContextMenu
            //
            this.NotifyIconContextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuRestore,
            this.menuClose});
            //
            // menuRestore
            //
            this.menuRestore.Index = 0;
            this.menuRestore.Text = "Restore";
            this.menuRestore.Click += new System.EventHandler(this.menuRestore_Click);
            //
            // menuClose
            //
            this.menuClose.Index = 1;
            this.menuClose.Text = "Close";
            this.menuClose.Click += new System.EventHandler(this.menuClose_Click);
            //
            // lblAllRight
            //
            this.lblAllRight.AutoSize = true;
            this.lblAllRight.Font = new System.Drawing.Font("Verdana", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblAllRight.Location = new System.Drawing.Point(6, 703);
            this.lblAllRight.Name = "lblAllRight";
            this.lblAllRight.Size = new System.Drawing.Size(320, 13);
            this.lblAllRight.TabIndex = 65;
            this.lblAllRight.Text = "Copyright © 2006 SCL All Rights Reserved  版權所有 ";
            this.lblAllRight.Visible = false;
            //
            // pictureBox1
            //
            this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
            this.pictureBox1.Location = new System.Drawing.Point(6, 6);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(68, 48);
            this.pictureBox1.TabIndex = 28;
            this.pictureBox1.TabStop = false;
            //
            // cboServerIP
            //
            this.cboServerIP.BackColor = System.Drawing.Color.White;
            this.cboServerIP.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboServerIP.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cboServerIP.Location = new System.Drawing.Point(115, 56);
            this.cboServerIP.Name = "cboServerIP";
            this.cboServerIP.Size = new System.Drawing.Size(123, 20);
            this.cboServerIP.TabIndex = 63;
            this.cboServerIP.SelectedIndexChanged += new System.EventHandler(this.cboServerIP_SelectedIndexChanged);
            this.cboServerIP.Click += new System.EventHandler(this.cboServerIP_Click);
            //
            // cmdadd
            //
            this.cmdadd.BackColor = System.Drawing.Color.Transparent;
            this.cmdadd.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cmdadd.Location = new System.Drawing.Point(6, 120);
            this.cmdadd.Name = "cmdadd";
            this.cmdadd.Size = new System.Drawing.Size(80, 23);
            this.cmdadd.TabIndex = 19;
            this.cmdadd.Text = "Add";
            this.cmdadd.UseVisualStyleBackColor = false;
            this.cmdadd.Click += new System.EventHandler(this.cmdadd_Click);
            //
            // lblMode
            //
            this.lblMode.AutoSize = true;
            this.lblMode.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblMode.Location = new System.Drawing.Point(6, 88);
            this.lblMode.Name = "lblMode";
            this.lblMode.Size = new System.Drawing.Size(35, 12);
            this.lblMode.TabIndex = 5;
            this.lblMode.Text = "Mode:";
            //
            // lblANtSeq
            //
            this.lblANtSeq.AutoSize = true;
            this.lblANtSeq.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblANtSeq.Location = new System.Drawing.Point(260, 93);
            this.lblANtSeq.Name = "lblANtSeq";
            this.lblANtSeq.Size = new System.Drawing.Size(45, 12);
            this.lblANtSeq.TabIndex = 9;
            this.lblANtSeq.Text = "Ant Seq:";
            //
            // txtAntSeq
            //
            this.txtAntSeq.BackColor = System.Drawing.Color.White;
            this.txtAntSeq.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtAntSeq.Location = new System.Drawing.Point(370, 85);
            this.txtAntSeq.Name = "txtAntSeq";
            this.txtAntSeq.Size = new System.Drawing.Size(100, 22);
            this.txtAntSeq.TabIndex = 10;
            this.txtAntSeq.Text = "1,2,3,4";
            this.txtAntSeq.MouseClick += new System.Windows.Forms.MouseEventHandler(this.txtAntSeq_MouseClick);
            //
            // lblReaderIP
            //
            this.lblReaderIP.AutoSize = true;
            this.lblReaderIP.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblReaderIP.Location = new System.Drawing.Point(260, 29);
            this.lblReaderIP.Name = "lblReaderIP";
            this.lblReaderIP.Size = new System.Drawing.Size(54, 12);
            this.lblReaderIP.TabIndex = 12;
            this.lblReaderIP.Text = "Reader IP:";
            //
            // lblaction
            //
            this.lblaction.AutoSize = true;
            this.lblaction.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblaction.Location = new System.Drawing.Point(6, 24);
            this.lblaction.Name = "lblaction";
            this.lblaction.Size = new System.Drawing.Size(39, 12);
            this.lblaction.TabIndex = 27;
            this.lblaction.Text = "Action:";
            //
            // cboMode
            //
            this.cboMode.BackColor = System.Drawing.Color.White;
            this.cboMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboMode.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cboMode.Location = new System.Drawing.Point(115, 88);
            this.cboMode.Name = "cboMode";
            this.cboMode.Size = new System.Drawing.Size(123, 20);
            this.cboMode.TabIndex = 11;
            this.cboMode.SelectedIndexChanged += new System.EventHandler(this.cboMode_SelectedIndexChanged);
            this.cboMode.Click += new System.EventHandler(this.cboMode_Click);
            //
            // lblport
            //
            this.lblport.AutoSize = true;
            this.lblport.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblport.Location = new System.Drawing.Point(260, 61);
            this.lblport.Name = "lblport";
            this.lblport.Size = new System.Drawing.Size(27, 12);
            this.lblport.TabIndex = 16;
            this.lblport.Text = "Port:";
            //
            // txtport
            //
            this.txtport.BackColor = System.Drawing.Color.White;
            this.txtport.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtport.Location = new System.Drawing.Point(370, 53);
            this.txtport.Name = "txtport";
            this.txtport.ReadOnly = true;
            this.txtport.Size = new System.Drawing.Size(100, 22);
            this.txtport.TabIndex = 17;
            this.txtport.Text = "10000";
            this.txtport.MouseClick += new System.Windows.Forms.MouseEventHandler(this.txtport_MouseClick);
            //
            // lblSIP
            //
            this.lblSIP.AutoSize = true;
            this.lblSIP.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblSIP.Location = new System.Drawing.Point(6, 56);
            this.lblSIP.Name = "lblSIP";
            this.lblSIP.Size = new System.Drawing.Size(51, 12);
            this.lblSIP.TabIndex = 4;
            this.lblSIP.Text = "Server IP:";
            //
            // cmdExternalOutput
            //
            this.cmdExternalOutput.BackColor = System.Drawing.SystemColors.Highlight;
            this.cmdExternalOutput.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.cmdExternalOutput.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cmdExternalOutput.Location = new System.Drawing.Point(86, 120);
            this.cmdExternalOutput.Name = "cmdExternalOutput";
            this.cmdExternalOutput.Size = new System.Drawing.Size(85, 23);
            this.cmdExternalOutput.TabIndex = 36;
            this.cmdExternalOutput.Text = "External Output";
            this.cmdExternalOutput.UseVisualStyleBackColor = false;
            this.cmdExternalOutput.Visible = false;
            this.cmdExternalOutput.Click += new System.EventHandler(this.cmdExternalOutput_Click);
            //
            // cboReaderIP
            //
            this.cboReaderIP.BackColor = System.Drawing.Color.White;
            this.cboReaderIP.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboReaderIP.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cboReaderIP.Location = new System.Drawing.Point(370, 21);
            this.cboReaderIP.Name = "cboReaderIP";
            this.cboReaderIP.Size = new System.Drawing.Size(102, 20);
            this.cboReaderIP.TabIndex = 37;
            this.cboReaderIP.SelectedIndexChanged += new System.EventHandler(this.cboReaderIP_SelectedIndexChanged);
            //
            // cboAction
            //
            this.cboAction.BackColor = System.Drawing.Color.White;
            this.cboAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cboAction.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.cboAction.Location = new System.Drawing.Point(115, 24);
            this.cboAction.Name = "cboAction";
            this.cboAction.Size = new System.Drawing.Size(123, 20);
            this.cboAction.TabIndex = 64;
            this.cboAction.SelectedIndexChanged += new System.EventHandler(this.cboAction_SelectedIndexChanged);
            this.cboAction.Click += new System.EventHandler(this.cboAction_Click);
            //
            // ActionBox
            //
            this.ActionBox.Controls.Add(this.cboAction);
            this.ActionBox.Controls.Add(this.cboReaderIP);
            this.ActionBox.Controls.Add(this.cmdExternalOutput);
            this.ActionBox.Controls.Add(this.lblSIP);
            this.ActionBox.Controls.Add(this.txtport);
            this.ActionBox.Controls.Add(this.lblport);
            this.ActionBox.Controls.Add(this.cboMode);
            this.ActionBox.Controls.Add(this.lblaction);
            this.ActionBox.Controls.Add(this.lblReaderIP);
            this.ActionBox.Controls.Add(this.txtAntSeq);
            this.ActionBox.Controls.Add(this.lblANtSeq);
            this.ActionBox.Controls.Add(this.lblMode);
            this.ActionBox.Controls.Add(this.cmdadd);
            this.ActionBox.Controls.Add(this.cboServerIP);
            this.ActionBox.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.ActionBox.Location = new System.Drawing.Point(14, 186);
            this.ActionBox.Name = "ActionBox";
            this.ActionBox.Size = new System.Drawing.Size(532, 152);
            this.ActionBox.TabIndex = 30;
            this.ActionBox.TabStop = false;
            this.ActionBox.Text = "Action Command";
            //
            // bImageButton1
            //
            this.bImageButton1.BackColor = System.Drawing.Color.Transparent;
            this.bImageButton1.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.bImageButton1.Image = ((System.Drawing.Image)(resources.GetObject("bImageButton1.Image")));
            this.bImageButton1.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
            this.bImageButton1.Location = new System.Drawing.Point(743, 6);
            this.bImageButton1.Name = "bImageButton1";
            this.bImageButton1.Size = new System.Drawing.Size(55, 56);
            this.bImageButton1.TabIndex = 54;
            this.bImageButton1.Text = "Reset";
            this.bImageButton1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.bImageButton1.UseVisualStyleBackColor = false;
            this.bImageButton1.Click += new System.EventHandler(this.bImageButton1_Click);
            //
            // bExitButton1
            //
            this.bExitButton1.BackColor = System.Drawing.Color.DarkGray;
            this.bExitButton1.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.bExitButton1.Image = ((System.Drawing.Image)(resources.GetObject("bExitButton1.Image")));
            this.bExitButton1.ImageAlign = System.Drawing.ContentAlignment.TopCenter;
            this.bExitButton1.Location = new System.Drawing.Point(800, 5);
            this.bExitButton1.Name = "bExitButton1";
            this.bExitButton1.Size = new System.Drawing.Size(56, 56);
            this.bExitButton1.TabIndex = 55;
            this.bExitButton1.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.bExitButton1.UseVisualStyleBackColor = false;
            this.bExitButton1.Click += new System.EventHandler(this.bExitButton1_Click_1);
            //
            // txtTimeOut
            //
            this.txtTimeOut.BackColor = System.Drawing.Color.White;
            this.txtTimeOut.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtTimeOut.Location = new System.Drawing.Point(160, 64);
            this.txtTimeOut.Name = "txtTimeOut";
            this.txtTimeOut.ReadOnly = true;
            this.txtTimeOut.Size = new System.Drawing.Size(23, 22);
            this.txtTimeOut.TabIndex = 63;
            //
            // lblFilteringPara
            //
            this.lblFilteringPara.AllowDrop = true;
            this.lblFilteringPara.AutoSize = true;
            this.lblFilteringPara.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblFilteringPara.Location = new System.Drawing.Point(11, 64);
            this.lblFilteringPara.Name = "lblFilteringPara";
            this.lblFilteringPara.Size = new System.Drawing.Size(118, 12);
            this.lblFilteringPara.TabIndex = 64;
            this.lblFilteringPara.Text = "Filtering Parameter(sec):";
            //
            // lblReadingFreq
            //
            this.lblReadingFreq.AutoSize = true;
            this.lblReadingFreq.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblReadingFreq.Location = new System.Drawing.Point(189, 64);
            this.lblReadingFreq.Name = "lblReadingFreq";
            this.lblReadingFreq.Size = new System.Drawing.Size(90, 12);
            this.lblReadingFreq.TabIndex = 65;
            this.lblReadingFreq.Text = "Read Count(unit):";
            //
            // txtReadingFreq
            //
            this.txtReadingFreq.BackColor = System.Drawing.Color.White;
            this.txtReadingFreq.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtReadingFreq.Location = new System.Drawing.Point(312, 64);
            this.txtReadingFreq.Name = "txtReadingFreq";
            this.txtReadingFreq.ReadOnly = true;
            this.txtReadingFreq.Size = new System.Drawing.Size(23, 22);
            this.txtReadingFreq.TabIndex = 66;
            //
            // bLabel2
            //
            this.bLabel2.AutoSize = true;
            this.bLabel2.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.bLabel2.Location = new System.Drawing.Point(356, 32);
            this.bLabel2.Name = "bLabel2";
            this.bLabel2.Size = new System.Drawing.Size(77, 12);
            this.bLabel2.TabIndex = 67;
            this.bLabel2.Text = "Wake Up (sec):";
            //
            // txtWakeUPCount
            //
            this.txtWakeUPCount.BackColor = System.Drawing.Color.White;
            this.txtWakeUPCount.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtWakeUPCount.Location = new System.Drawing.Point(480, 32);
            this.txtWakeUPCount.Name = "txtWakeUPCount";
            this.txtWakeUPCount.ReadOnly = true;
            this.txtWakeUPCount.Size = new System.Drawing.Size(23, 22);
            this.txtWakeUPCount.TabIndex = 68;
            this.txtWakeUPCount.Text = "0";
            //
            // lblrfattenuation
            //
            this.lblrfattenuation.AutoSize = true;
            this.lblrfattenuation.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblrfattenuation.Location = new System.Drawing.Point(189, 32);
            this.lblrfattenuation.Name = "lblrfattenuation";
            this.lblrfattenuation.Size = new System.Drawing.Size(105, 12);
            this.lblrfattenuation.TabIndex = 69;
            this.lblrfattenuation.Text = "RF Attenuation(unit):";
            //
            // txtrfattenuation
            //
            this.txtrfattenuation.BackColor = System.Drawing.Color.White;
            this.txtrfattenuation.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtrfattenuation.Location = new System.Drawing.Point(312, 32);
            this.txtrfattenuation.Name = "txtrfattenuation";
            this.txtrfattenuation.ReadOnly = true;
            this.txtrfattenuation.Size = new System.Drawing.Size(23, 22);
            this.txtrfattenuation.TabIndex = 70;
            //
            // lblwritetagAnt
            //
            this.lblwritetagAnt.AutoSize = true;
            this.lblwritetagAnt.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblwritetagAnt.Location = new System.Drawing.Point(11, 32);
            this.lblwritetagAnt.Name = "lblwritetagAnt";
            this.lblwritetagAnt.Size = new System.Drawing.Size(138, 12);
            this.lblwritetagAnt.TabIndex = 71;
            this.lblwritetagAnt.Text = "Write Tag Attenuation(unit):";
            //
            // txtwritetagAtt
            //
            this.txtwritetagAtt.BackColor = System.Drawing.Color.White;
            this.txtwritetagAtt.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtwritetagAtt.Location = new System.Drawing.Point(160, 32);
            this.txtwritetagAtt.Name = "txtwritetagAtt";
            this.txtwritetagAtt.ReadOnly = true;
            this.txtwritetagAtt.Size = new System.Drawing.Size(23, 22);
            this.txtwritetagAtt.TabIndex = 72;
            //
            // groupBox3
            //
            this.groupBox3.Controls.Add(this.TxtSingleTagRead);
            this.groupBox3.Controls.Add(this.LblSingleTagRead);
            this.groupBox3.Controls.Add(this.TxtMultiTag);
            this.groupBox3.Controls.Add(this.LblMultiTag);
            this.groupBox3.Controls.Add(this.TxtMainInterface);
            this.groupBox3.Controls.Add(this.LblMainInterface);
            this.groupBox3.Controls.Add(this.txtwritetagAtt);
            this.groupBox3.Controls.Add(this.lblwritetagAnt);
            this.groupBox3.Controls.Add(this.txtrfattenuation);
            this.groupBox3.Controls.Add(this.lblrfattenuation);
            this.groupBox3.Controls.Add(this.txtWakeUPCount);
            this.groupBox3.Controls.Add(this.bLabel2);
            this.groupBox3.Controls.Add(this.txtReadingFreq);
            this.groupBox3.Controls.Add(this.lblReadingFreq);
            this.groupBox3.Controls.Add(this.lblFilteringPara);
            this.groupBox3.Controls.Add(this.txtTimeOut);
            this.groupBox3.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.groupBox3.Location = new System.Drawing.Point(14, 81);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(698, 96);
            this.groupBox3.TabIndex = 64;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Client Command";
            //
            // TxtSingleTagRead
            //
            this.TxtSingleTagRead.BackColor = System.Drawing.Color.White;
            this.TxtSingleTagRead.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.TxtSingleTagRead.Location = new System.Drawing.Point(632, 64);
            this.TxtSingleTagRead.Name = "TxtSingleTagRead";
            this.TxtSingleTagRead.Size = new System.Drawing.Size(23, 22);
            this.TxtSingleTagRead.TabIndex = 78;
            this.TxtSingleTagRead.Text = "1";
            //
            // LblSingleTagRead
            //
            this.LblSingleTagRead.AutoSize = true;
            this.LblSingleTagRead.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.LblSingleTagRead.Location = new System.Drawing.Point(512, 64);
            this.LblSingleTagRead.Name = "LblSingleTagRead";
            this.LblSingleTagRead.Size = new System.Drawing.Size(87, 12);
            this.LblSingleTagRead.TabIndex = 77;
            this.LblSingleTagRead.Text = "Single Tag (min):";
            //
            // TxtMultiTag
            //
            this.TxtMultiTag.BackColor = System.Drawing.Color.White;
            this.TxtMultiTag.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.TxtMultiTag.Location = new System.Drawing.Point(632, 32);
            this.TxtMultiTag.Name = "TxtMultiTag";
            this.TxtMultiTag.Size = new System.Drawing.Size(23, 22);
            this.TxtMultiTag.TabIndex = 76;
            this.TxtMultiTag.Text = "1";
            //
            // LblMultiTag
            //
            this.LblMultiTag.AutoSize = true;
            this.LblMultiTag.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.LblMultiTag.Location = new System.Drawing.Point(512, 32);
            this.LblMultiTag.Name = "LblMultiTag";
            this.LblMultiTag.Size = new System.Drawing.Size(83, 12);
            this.LblMultiTag.TabIndex = 75;
            this.LblMultiTag.Text = "Multi Tag (min):";
            //
            // TxtMainInterface
            //
            this.TxtMainInterface.BackColor = System.Drawing.Color.White;
            this.TxtMainInterface.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.TxtMainInterface.Location = new System.Drawing.Point(480, 64);
            this.TxtMainInterface.Name = "TxtMainInterface";
            this.TxtMainInterface.Size = new System.Drawing.Size(23, 22);
            this.TxtMainInterface.TabIndex = 74;
            this.TxtMainInterface.Text = "2";
            //
            // LblMainInterface
            //
            this.LblMainInterface.AutoSize = true;
            this.LblMainInterface.Font = new System.Drawing.Font("PMingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.LblMainInterface.Location = new System.Drawing.Point(356, 64);
            this.LblMainInterface.Name = "LblMainInterface";
            this.LblMainInterface.Size = new System.Drawing.Size(117, 12);
            this.LblMainInterface.TabIndex = 73;
            this.LblMainInterface.Text = "To Main Interface (sec):";
            //
            // txtCurrentDateTime
            //
            this.txtCurrentDateTime.BackColor = System.Drawing.Color.White;
            this.txtCurrentDateTime.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.txtCurrentDateTime.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.txtCurrentDateTime.Location = new System.Drawing.Point(582, 46);
            this.txtCurrentDateTime.Name = "txtCurrentDateTime";
            this.txtCurrentDateTime.ReadOnly = true;
            this.txtCurrentDateTime.Size = new System.Drawing.Size(136, 15);
            this.txtCurrentDateTime.TabIndex = 44;
            //
            // lblconnecting
            //
            this.lblconnecting.AutoSize = true;
            this.lblconnecting.BackColor = System.Drawing.Color.Transparent;
            this.lblconnecting.Font = new System.Drawing.Font("Verdana", 11F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblconnecting.ForeColor = System.Drawing.Color.Blue;
            this.lblconnecting.Location = new System.Drawing.Point(84, 39);
            this.lblconnecting.Name = "lblconnecting";
            this.lblconnecting.Size = new System.Drawing.Size(47, 15);
            this.lblconnecting.TabIndex = 53;
            this.lblconnecting.Text = "Ready";
            //
            // tabControl1
            //
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.ItemSize = new System.Drawing.Size(200, 17);
            this.tabControl1.Location = new System.Drawing.Point(-2, -2);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(1018, 664);
            this.tabControl1.TabIndex = 67;
            this.tabControl1.Selecting += new System.Windows.Forms.TabControlCancelEventHandler(this.tabControl1_Selecting);
            this.tabControl1.TabIndexChanged += new System.EventHandler(this.tabControl1_TabIndexChanged);
            this.tabControl1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tabControl1_KeyDown);
            //
            // tabPage1
            //
            this.tabPage1.Controls.Add(this.plInputTagNo);
            this.tabPage1.Controls.Add(this.lblDBCount);
            this.tabPage1.Controls.Add(this.lblTagCount);
            this.tabPage1.Controls.Add(this.lblTagNo);
            this.tabPage1.Controls.Add(this.lblAlertMSG);
            this.tabPage1.Controls.Add(this.lblStatus);
            this.tabPage1.Controls.Add(this.lblCartonQty);
            this.tabPage1.Controls.Add(this.lblJobNo);
            this.tabPage1.Controls.Add(this.pitLogo);
            this.tabPage1.Location = new System.Drawing.Point(4, 21);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage1.Size = new System.Drawing.Size(1010, 639);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "界面";
            this.tabPage1.UseVisualStyleBackColor = true;
            //
            // plInputTagNo
            //
            this.plInputTagNo.BackgroundImage = global::RFIDClient.Properties.Resources.pitLogo_BackgroundImage;
            this.plInputTagNo.Controls.Add(this.btnYes);
            this.plInputTagNo.Controls.Add(this.txtcTagNo);
            this.plInputTagNo.Controls.Add(this.label1);
            this.plInputTagNo.Location = new System.Drawing.Point(9, 74);
            this.plInputTagNo.Name = "plInputTagNo";
            this.plInputTagNo.Size = new System.Drawing.Size(375, 46);
            this.plInputTagNo.TabIndex = 17;
            //
            // btnYes
            //
            this.btnYes.Location = new System.Drawing.Point(261, 9);
            this.btnYes.Name = "btnYes";
            this.btnYes.Size = new System.Drawing.Size(84, 32);
            this.btnYes.TabIndex = 2;
            this.btnYes.Text = "確定";
            this.btnYes.UseVisualStyleBackColor = true;
            this.btnYes.Click += new System.EventHandler(this.btnYes_Click);
            //
            // txtcTagNo
            //
            this.txtcTagNo.Location = new System.Drawing.Point(109, 16);
            this.txtcTagNo.Name = "txtcTagNo";
            this.txtcTagNo.Size = new System.Drawing.Size(127, 23);
            this.txtcTagNo.TabIndex = 1;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 19);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(91, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "輸入標簽編號";
            //
            // lblDBCount
            //
            this.lblDBCount.AutoSize = true;
            this.lblDBCount.Font = new System.Drawing.Font("MingLiU", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblDBCount.ForeColor = System.Drawing.SystemColors.ActiveCaption;
            this.lblDBCount.Location = new System.Drawing.Point(3, 223);
            this.lblDBCount.Name = "lblDBCount";
            this.lblDBCount.Size = new System.Drawing.Size(60, 64);
            this.lblDBCount.TabIndex = 13;
            this.lblDBCount.Text = "0";
            this.lblDBCount.Visible = false;
            //
            // lblTagCount
            //
            this.lblTagCount.AutoSize = true;
            this.lblTagCount.Font = new System.Drawing.Font("MingLiU", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblTagCount.Location = new System.Drawing.Point(3, 124);
            this.lblTagCount.Name = "lblTagCount";
            this.lblTagCount.Size = new System.Drawing.Size(60, 64);
            this.lblTagCount.TabIndex = 12;
            this.lblTagCount.Text = "0";
            this.lblTagCount.Visible = false;
            //
            // lblTagNo
            //
            this.lblTagNo.BackColor = System.Drawing.Color.Transparent;
            this.lblTagNo.Font = new System.Drawing.Font("MingLiU", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblTagNo.Location = new System.Drawing.Point(26, 568);
            this.lblTagNo.Name = "lblTagNo";
            this.lblTagNo.Size = new System.Drawing.Size(960, 48);
            this.lblTagNo.TabIndex = 10;
            this.lblTagNo.Text = "卡板編號:XXXX";
            this.lblTagNo.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            this.lblTagNo.Visible = false;
            //
            // lblAlertMSG
            //
            this.lblAlertMSG.BackColor = System.Drawing.Color.Transparent;
            this.lblAlertMSG.Font = new System.Drawing.Font("MingLiU", 72F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblAlertMSG.Location = new System.Drawing.Point(26, 124);
            this.lblAlertMSG.Name = "lblAlertMSG";
            this.lblAlertMSG.Size = new System.Drawing.Size(960, 359);
            this.lblAlertMSG.TabIndex = 9;
            this.lblAlertMSG.Text = "警告:XXXXXXX";
            this.lblAlertMSG.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            this.lblAlertMSG.Visible = false;
            //
            // lblStatus
            //
            this.lblStatus.BackColor = System.Drawing.Color.Transparent;
            this.lblStatus.Font = new System.Drawing.Font("MingLiU", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblStatus.Location = new System.Drawing.Point(26, 494);
            this.lblStatus.Name = "lblStatus";
            this.lblStatus.Size = new System.Drawing.Size(960, 64);
            this.lblStatus.TabIndex = 8;
            this.lblStatus.Text = "狀態:XXXX";
            this.lblStatus.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            this.lblStatus.Visible = false;
            //
            // lblCartonQty
            //
            this.lblCartonQty.BackColor = System.Drawing.Color.Transparent;
            this.lblCartonQty.Font = new System.Drawing.Font("MingLiU", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblCartonQty.Location = new System.Drawing.Point(250, 207);
            this.lblCartonQty.Name = "lblCartonQty";
            this.lblCartonQty.Size = new System.Drawing.Size(514, 80);
            this.lblCartonQty.TabIndex = 7;
            this.lblCartonQty.Text = "卡板箱數:XX";
            this.lblCartonQty.Visible = false;
            //
            // lblJobNo
            //
            this.lblJobNo.BackColor = System.Drawing.Color.Transparent;
            this.lblJobNo.Font = new System.Drawing.Font("MingLiU", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lblJobNo.Location = new System.Drawing.Point(10, 17);
            this.lblJobNo.Name = "lblJobNo";
            this.lblJobNo.Size = new System.Drawing.Size(994, 64);
            this.lblJobNo.TabIndex = 6;
            this.lblJobNo.Text = "JobNo#:XXXXXXX";
            this.lblJobNo.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            this.lblJobNo.Visible = false;
            //
            // pitLogo
            //
            this.pitLogo.BackColor = System.Drawing.Color.Transparent;
            this.pitLogo.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pitLogo.BackgroundImage")));
            this.pitLogo.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.pitLogo.Location = new System.Drawing.Point(0, 3);
            this.pitLogo.Name = "pitLogo";
            this.pitLogo.Size = new System.Drawing.Size(1007, 630);
            this.pitLogo.TabIndex = 11;
            this.pitLogo.TabStop = false;
            //
            // tabPage2
            //
            this.tabPage2.Controls.Add(this.lblVersion);
            this.tabPage2.Controls.Add(this.lbl1);
            this.tabPage2.Controls.Add(this.bImageButton1);
            this.tabPage2.Controls.Add(this.cmdlogin);
            this.tabPage2.Controls.Add(this.groupBox1);
            this.tabPage2.Controls.Add(this.cmdstart);
            this.tabPage2.Controls.Add(this.groupBox3);
            this.tabPage2.Controls.Add(this.txtCurrentDateTime);
            this.tabPage2.Controls.Add(this.cmdcancel);
            this.tabPage2.Controls.Add(this.bExitButton1);
            this.tabPage2.Controls.Add(this.cmdCloseConnection);
            this.tabPage2.Controls.Add(this.ActionBox);
            this.tabPage2.Controls.Add(this.lblconnecting);
            this.tabPage2.Controls.Add(this.pictureBox1);
            this.tabPage2.Location = new System.Drawing.Point(4, 21);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage2.Size = new System.Drawing.Size(1010, 639);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "設置";
            this.tabPage2.UseVisualStyleBackColor = true;
            this.tabPage2.Click += new System.EventHandler(this.tabPage2_Click);
            //
            // lblVersion
            //
            this.lblVersion.AutoSize = true;
            this.lblVersion.Location = new System.Drawing.Point(546, 17);
            this.lblVersion.Name = "lblVersion";
            this.lblVersion.Size = new System.Drawing.Size(49, 13);
            this.lblVersion.TabIndex = 66;
            this.lblVersion.Text = "label1";
            //
            // lbl1
            //
            this.lbl1.AutoSize = true;
            this.lbl1.Font = new System.Drawing.Font("MingLiU", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.lbl1.Location = new System.Drawing.Point(80, 65);
            this.lbl1.Name = "lbl1";
            this.lbl1.Size = new System.Drawing.Size(53, 12);
            this.lbl1.TabIndex = 65;
            this.lbl1.Text = "TestTime";
            //
            // timer4
            //
            this.timer4.Interval = 300;
            this.timer4.Tick += new System.EventHandler(this.timer4_Tick);
            //
            // lblcollectstate
            //
            this.lblcollectstate.BackColor = System.Drawing.Color.Transparent;
            this.lblcollectstate.Font = new System.Drawing.Font("Verdana", 36F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblcollectstate.ForeColor = System.Drawing.Color.Blue;
            this.lblcollectstate.Location = new System.Drawing.Point(332, 680);
            this.lblcollectstate.Name = "lblcollectstate";
            this.lblcollectstate.Size = new System.Drawing.Size(587, 79);
            this.lblcollectstate.TabIndex = 68;
            this.lblcollectstate.Text = "Ready";
            //
            // CountdownTimer
            //
            this.CountdownTimer.Interval = 500;
            this.CountdownTimer.Tick += new System.EventHandler(this.CountdownTimer_Tick_1);
            //
            // timer5
            //
            this.timer5.Interval = 1000;
            this.timer5.Tick += new System.EventHandler(this.timer5_Tick);
            //
            // RFIDFloor
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(7, 16);
            this.BackColor = System.Drawing.Color.DarkGray;
            this.ClientSize = new System.Drawing.Size(1024, 768);
            this.ControlBox = false;
            this.Controls.Add(this.lblcollectstate);
            this.Controls.Add(this.tabControl1);
            this.Controls.Add(this.lblAllRight);
            this.Font = new System.Drawing.Font("MingLiU", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "RFIDFloor";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            this.Text = "出樓層功能";
            this.TopMost = true;
            this.Load += new System.EventHandler(this.RFIDTestClient_Load);
            this.Closed += new System.EventHandler(this.RFIDTestClient_Closed);
            this.Closing += new System.ComponentModel.CancelEventHandler(this.RFIDTestClient_Closing);
            this.Resize += new System.EventHandler(this.RFIDTestClient_Resize);
            ((System.ComponentModel.ISupportInitialize)(this.DgSelect)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.DgResult)).EndInit();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            this.ActionBox.ResumeLayout(false);
            this.ActionBox.PerformLayout();
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabPage1.PerformLayout();
            this.plInputTagNo.ResumeLayout(false);
            this.plInputTagNo.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.pitLogo)).EndInit();
            this.tabPage2.ResumeLayout(false);
            this.tabPage2.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        //Add By XueKeHuang 2008/07/04 Begin
        private int CountTimeValue = 0;
        private bool blnClickTabPage2;
        private bool blnGotoTabPage2;
        //End

        private void tabControl1_Selecting(object sender, TabControlCancelEventArgs e)
        {
            if (e.TabPageIndex == 0)
                return;

            //System.Diagnostics.Process.Start("osk.exe");
            AdminLogin login = new AdminLogin();

            login.ShowDialog(this);

            if (login.LoginSuccessful == true)
            {
                //this.tabControl1.TabPages.Add(this.tabPage2);
                this.TopMost = true;

                //Add By XueKeHuang 2008/07/04 Begin
                this.timer5.Start();
                CountTimeValue = 0;
                blnGotoTabPage2 = true;
                blnClickTabPage2 = false;
                //End
            }
            else
            {
                e.Cancel = true;
            }

        }


        #endregion

 

        //  [STAThread]


        // Method :                       DisplayByTagID
        // Description :                  It is used to call stored procedure, and get the return value to control
        //                                      display interface
        //                                      It is called after the tag id match the condition of Filtering parameter
        //                                      and Read count
        // Input :                            tagID (It is the tag id which match the condition of Filtering parameter
        //                                      and Read count)
        // Output :                         null
        /// <summary>
        /// 添加jobFloor的属性到JobNoList中
        /// </summary>
        /// <param name="tagID"></param>
        /// <param name="CDBSPMethod"></param>
        private void DisplayByTagID(string tagID, CDBSPMethed CDBSPMethod)
        {
            //CDBSPMethed CDBSPMethod = null;
            SqlCommand CheckCommand = null;
            System.Data.SqlClient.SqlDataAdapter retrieveDataAdapter;
            DataTable dtTable;
            DataView dvTable;
            JobNoFloor jobFloor = null;

            //******* Add By XueKeHuang 2008-10-31 處理小型機台TAG********************************Begin
           
            if (PrexTagNo.ToString().Trim().ToUpper() == "CC")
            {
                #region 如果是小型机台通过,则判断是否存在,和添加相应的jobFloor属性到JobNoList
                try
                {
                    tagID = TagHandleMethod.RemodelATagNo(tagID);

                    this.TagNo1 = tagID.ToUpper();//Add By XKH 2009-03-04

                    CheckCommand = new SqlCommand();
                    CheckCommand.CommandText = "usp_lems_GateDoor";
                    CheckCommand.CommandType = CommandType.StoredProcedure;
                    CheckCommand.Connection = CDBSPMethod.GetConn();
                    CheckCommand.Parameters.Add("@GateDoorIP", SqlDbType.NVarChar, 16);
                    CheckCommand.Parameters.Add("@RFID", SqlDbType.VarChar, 24);

                    CheckCommand.Parameters["@GateDoorIP"].Value = GetCurrentIP.GetLocalIP();
                    CheckCommand.Parameters["@RFID"].Value = tagID;

                    dtTable = new DataTable();

                    //dvTable = new DataView();//Add By XKH 2009-03-03

                    retrieveDataAdapter = new System.Data.SqlClient.SqlDataAdapter();
                    retrieveDataAdapter.SelectCommand = CheckCommand;
                    retrieveDataAdapter.Fill(dtTable);

                    dvTable = dtTable.DefaultView;
                    dvTable.RowFilter = "";

                    #region if (dvTable.Count > 0)//根据GateDoorIP以及RFID判断此机台是否存在,从而设置相应jobFloor属性,并添加到JobNoList中
                    if (dvTable.Count > 0)
                    {
                        // 返回狀態1:正常,0:失敗
                        int iStatus = int.Parse(dvTable[0]["status"].ToString().Trim());

                        #region 当状态为正常1时,显示正常通过,并设置相应的颜色以及显示是否正常--- 有待优化
                        //int iStatus = 1;
                        // 返回警告信息
                        string strAlertMSG;
                        if (iStatus == 1)
                            strAlertMSG = "小型機台正常通過!";
                        else
                            strAlertMSG = dvTable[0]["message"].ToString().Trim();

                        string cEqnum = "";
                        if (strAlertMSG != "GateDoor資訊不存在" && strAlertMSG != "機台借機資訊不存在")
                        {
                            cEqnum = dvTable[0]["eqnum"].ToString().Trim(); //Add By XKH 2009-03-20 增加顯示機台編號欄位
                        }

                        //第一個版面背景色
                        int intBackColor;
                        if (iStatus == 1)
                            intBackColor = 1;
                        else
                            intBackColor = 0;

                        //指示燈顏色
                        int intPilotLampColor;
                        if (iStatus == 1)
                            intPilotLampColor = 1;
                        else
                            intPilotLampColor = 0;

                        //顯示介面
                        int intInterFace;
                        if (iStatus == 1)
                            intInterFace = 1;
                        else
                            intInterFace = 0;

                        //提示聲音
                        int intSoundMSG;
                        if (iStatus == 1)
                            intSoundMSG = 1;
                        else
                            intSoundMSG = 0;

                        //狀態Label顯示
                        string strInOutStatus;
                        if (iStatus == 1)
                            strInOutStatus = "";
                        else
                            strInOutStatus = "不正常";
                        #endregion

                        jobFloor = new JobNoFloor();
                        jobFloor.DiscovertTime = DateTime.Now;
                        jobFloor.LastSeenTime = DateTime.Now;
                        jobFloor.Interface = intInterFace;
                        jobFloor.BackColor = intBackColor;
                        jobFloor.AlertMSG = strAlertMSG;

                        //Modify By XKH 2009-03-20
                        //jobFloor.TagNo = tagID;
                        jobFloor.TagNo = cEqnum;

                        jobFloor.InOutStatus = strInOutStatus;
                        jobFloor.PilotLampColor = intPilotLampColor;
                        jobFloor.SoundMSG = intSoundMSG;
                        jobFloor.Shown = 0;
                        jobFloor.ShownOrder = 0;

                        this.JobNoList.Add(jobFloor);

                    }
                    else
                    {

                        jobFloor = new JobNoFloor();
                        jobFloor.TagNo = tagID;
                        jobFloor.Shown = 0;

                        if (JobNoList.Exist(jobFloor) >= 0)//存在列表中还需要添加???
                        {
                            JobNoList.Add(jobFloor);
                        }

                    }
                    #endregion
                }catch (SqlException ex)
                {
                    try
                    {
                        CheckCommand.Transaction.Rollback();
                    }
                    catch
                    {
                    }

                    LogHandler.LogDebugMessage(this.GetType(), "DisplayByTagID", ex);
                    LogHandler.LogInternalMessage(tagID);

                }
                catch (Exception ex)
                {
                    LogHandler.LogDebugMessage(this.GetType(), "DisplayByTagID", ex);
                    LogHandler.LogInternalMessage(tagID);
                }
                finally
                {
                    try
                    {
                        //**************Add By XKH 2009-03-02 Begin
                        writeLog.InitEndSQLData();
                        writeLog.InitRemark1(this.TagNo1.ToUpper());
                        isSaveKeepLog = false;//Added By Berlin 8/4/2009
                        if (this.TagNo1.ToUpper() != this.TagNo2.ToUpper() && (this.TagNo1.ToUpper() != ""))
                        {
                            //writeLog.WriteLogData(new CDBSPMethed().GetConn()); //Remark By Berlin 8/4/2009
                            isSaveKeepLog = true;//Added By Berlin 8/4/2009
                            //lblcollectstate.Text = "讀取標簽中...";//Add By XKH 2009-03-02
                        }
                        this.TagNo2 = this.TagNo1;
                        //***************End

                        CheckCommand.Transaction.Commit();

                    }
                    catch
                    {
                    }

                }
                #endregion
            }
            else
            {
                try
                {
                    tagID = TagHandleMethod.RemodelATagNo(tagID);

                    this.TagNo1 = tagID;

                    //CDBSPMethod = new CDBSPMethed();
                    CheckCommand = new SqlCommand();
                    CheckCommand.CommandText = "usp_RFIDGatedoorFloorCheckTag";
                    CheckCommand.CommandType = CommandType.StoredProcedure;
                    CheckCommand.Connection = CDBSPMethod.GetConn();
                    //Remark By XueKeHuang 2008/07/03 if exist then Find the bug as following
                    //CheckCommand.Transaction = CDBSPMethod.GetTran();

                    //Modify by Ryan 2007/01/01
                    //CheckCommand.Parameters.Add("@cTagNo", SqlDbType.NVarChar, 24);              
                    //CheckCommand.Parameters.Add("@cIP", SqlDbType.NVarChar, 32);
                    CheckCommand.Parameters.Add("@cTagNo", SqlDbType.VarChar, 24);
                    CheckCommand.Parameters.Add("@cIP", SqlDbType.VarChar, 16);

                    //****************************Add By XKH 2009-03-20 增加LOG記錄的時間 Begin
                    CheckCommand.Parameters.Add(new SqlParameter("@dBeginTime", SqlDbType.DateTime, 0, ParameterDirection.Output,
                        false, 0, 0, "dBeginTime", DataRowVersion.Default, null));
                    CheckCommand.Parameters.Add(new SqlParameter("@dEndTime", SqlDbType.DateTime, 0, ParameterDirection.Output,
                        false, 0, 0, "dEndTime", DataRowVersion.Default, null));
                    //**************************************End

                    CheckCommand.Parameters["@cTagNo"].Value = tagID;
                    CheckCommand.Parameters["@cIP"].Value = GetCurrentIP.GetLocalIP();

                    dtTable = new DataTable();

                    retrieveDataAdapter = new System.Data.SqlClient.SqlDataAdapter();
                    retrieveDataAdapter.SelectCommand = CheckCommand;
                    retrieveDataAdapter.Fill(dtTable);

                    lblDBCount.Text = (int.Parse(lblDBCount.Text) + 1).ToString();//15/04/2009 測試讀取DB的次數


                    dvTable = dtTable.DefaultView;
                    dvTable.RowFilter = "";

                    //****************************Add By XKH 2009-03-20 增加LOG記錄的時間 Begin
                    dBeginTime = Convert.ToDateTime(CheckCommand.Parameters["@dBeginTime"].Value);
                    dEndTime = Convert.ToDateTime(CheckCommand.Parameters["@dEndTime"].Value);
                    //**************************************End

                    if (dvTable.Count > 0)
                    {
                        int intBackColor = Convert.IsDBNull(dvTable[0]["BackColor"]) ? -1 : (int)dvTable[0]["BackColor"];
                        string strJobNo = Convert.IsDBNull(dvTable[0]["JobNo"]) ? "" : ((string)dvTable[0]["JobNo"]).Trim();
                        string strCartonQty = Convert.IsDBNull(dvTable[0]["CartonQty"]) ? "" : ((string)dvTable[0]["CartonQty"]).Trim();
                        string strAlertMSG = Convert.IsDBNull(dvTable[0]["AlertMSG"]) ? "" : ((string)dvTable[0]["AlertMSG"]).Trim();
                        string strTagNo = Convert.IsDBNull(dvTable[0]["TagNo"]) ? "" : ((string)dvTable[0]["TagNo"]).Trim();
                        int intInterFace = Convert.IsDBNull(dvTable[0]["InterFace"]) ? -1 : (int)dvTable[0]["InterFace"];
                        string strInOutStatus = Convert.IsDBNull(dvTable[0]["InOutStatus"]) ? "" : ((string)dvTable[0]["InOutStatus"]).Trim();
                        int intPilotLampColor = Convert.IsDBNull(dvTable[0]["PilotLampColor"]) ? -1 : (int)dvTable[0]["PilotLampColor"];
                        int intSoundMSG = Convert.IsDBNull(dvTable[0]["SoundMSG"]) ? -1 : (int)dvTable[0]["SoundMSG"];

                        string[] qty = strCartonQty.Split(new char[] { ':', ':' });
                        int intQty = 0;
                        if (qty != null && qty.Length == 2)
                        {
                            try
                            {
                                intQty = int.Parse(qty[1].Trim());
                            }
                            catch
                            {
                                intQty = 0;
                            }
                        }
                        string[] jobNos = strJobNo.Split(new char[] { ':', ':' });
                        if (jobNos != null && jobNos.Length == 2)
                        {
                            strJobNo = jobNos[1];
                        }

                        jobFloor = new JobNoFloor();
                        jobFloor.JobNo = strJobNo;
                        jobFloor.DiscovertTime = DateTime.Now;
                        jobFloor.LastSeenTime = DateTime.Now;
                        jobFloor.Interface = intInterFace;
                        jobFloor.CartonQty = intQty;
                        jobFloor.BackColor = intBackColor;
                        jobFloor.AlertMSG = strAlertMSG;
                        jobFloor.TagNo = tagID;
                        jobFloor.InOutStatus = strInOutStatus;
                        jobFloor.PilotLampColor = intPilotLampColor;
                        jobFloor.SoundMSG = intSoundMSG;
                        jobFloor.Shown = 0;
                        jobFloor.ShownOrder = 0;

                        if (JobNoList.Exist(jobFloor) == -1)
                        {
                            //***********************************************************
                            // Date : 17/05/2007
                            // Description : It is used to insert the AlertMessage into SQLDB

                            if (intInterFace == 3 || intInterFace == 6)
                            {
                                DBOperate.InsertAlertMessage(tagID, strAlertMSG);
                            }
                            //***********************************************************

                        }

                        //JobNoList = new JobNoFloorList(); //Add By XKH 2009-03-03

                        this.JobNoList.Add(jobFloor);

                        //DataView dv = this.dtjobNo.DefaultView;

                        //dv.RowFilter = "TagNo = '" + tagID + "' ";

                        //if (dv.Count > 0)
                        //{
                        //    dv[0]["LastSeenTime"] = DateTime.Now;
                        //    dv[0]["Shown"] = 0;
                        //}
                        //else
                        //{
                        //    DataRow dr = this.dtjobNo.NewRow();
                        //    dr[0] = strJobNo;
                        //    dr[1] = DateTime.Now;
                        //    dr[2] = DateTime.Now;
                        //    dr[3] = intInterFace;
                        //    dr[4] = intQty;
                        //    dr[5] = intBackColor;
                        //    dr[6] = strAlertMSG;
                        //    dr[7] = tagID;
                        //    dr[8] = strInOutStatus;
                        //    dr[9] = intPilotLampColor;
                        //    dr[10] = intSoundMSG;
                        //    dr[11] = 0;
                        //    dr[12] = 0;
                        //    this.dtjobNo.Rows.Add(dr);

                        //    //***********************************************************
                        //    // Date : 17/05/2007
                        //    // Description : It is used to insert the AlertMessage into SQLDB

                        //    if (intInterFace == 3 || intInterFace == 6)
                        //    {
                        //        DBOperate.InsertAlertMessage(tagID, strAlertMSG);
                        //    }
                        //    //***********************************************************

                        //    // ************************************************************
                        //    // Date : 10/01/2007
                        //    // Description : It is used to check the status of the tag inside
                        //    // datatable, and start count down to the main interface
                        //    // Date : 28/02/2007
                        //    // Description: Reset all the tag information displaying depend on the Countdown_Timer

                        //    //this.ChangeVisibility(-1);                          // Modified at 12/01/2007
                        //    //if (!this.CheckExistingTagInfo())
                        //    //{
                        //    //    this.DisplayNewTagInfo();
                        //    //}

                        //    //this.isStartCountdown = true;
                        //    //this.dtCountdown = DateTime.Now;

                        //    // ************************************************************
                        //}
                        //dv.RowFilter = "";
                    }
                    else
                    {

                        jobFloor = new JobNoFloor();
                        jobFloor.TagNo = tagID;
                        jobFloor.Shown = 0;

                        if (JobNoList.Exist(jobFloor) >= 0)
                        {
                            JobNoList.Add(jobFloor);
                        }

                        //DataView dv = this.dtjobNo.DefaultView;
                        //dv.RowFilter = "TagNo = '" + tagID + "' ";

                        //if (dv.Count > 0)
                        //{
                        //    dv[0]["LastSeenTime"] = DateTime.Now;
                        //    dv[0]["Shown"] = 0;
                        //}
                        //else
                        //{
                        //    DataRow dr = this.dtjobNo.NewRow();
                        //    dr[0] = "";
                        //    dr[1] = DateTime.Now;
                        //    dr[2] = DateTime.Now;
                        //    dr[3] = -1;
                        //    dr[4] = 0;
                        //    dr[5] = 0;
                        //    dr[6] = "";
                        //    dr[7] = tagID;
                        //    dr[8] = "";
                        //    dr[9] = 0;
                        //    dr[10] = 0;
                        //    dr[11] = 1;
                        //    dr[12]=0;
                        //    this.dtjobNo.Rows.Add(dr);
                        //}
                        //dv.RowFilter = "";
                    }
                }

                catch (SqlException ex)
                {
                    try
                    {
                        CheckCommand.Transaction.Rollback();
                    }
                    catch
                    {
                    }

                    LogHandler.LogDebugMessage(this.GetType(), "DisplayByTagID", ex);
                    LogHandler.LogInternalMessage(tagID);

                }
                catch (Exception ex)
                {
                    LogHandler.LogDebugMessage(this.GetType(), "DisplayByTagID", ex);
                    LogHandler.LogInternalMessage(tagID);
                }
                finally
                {
                    try
                    {
                        writeLog.InitEndSQLData();//Add By XKH 2009-03-02
                        writeLog.InitRemark1(this.TagNo1.ToUpper());

                        writeLog.InitStatFunctionData(dBeginTime);//Add By XKH 2009-03-20
                        writeLog.InitEndFunctionData(dEndTime);//Add By XKH 2009-03-20
                        isSaveKeepLog = false;//Added By Berlin 8/4/2009
                        if (this.TagNo1.ToUpper() != this.TagNo2.ToUpper() && (this.TagNo1.ToUpper() != ""))//Add By XKH 2009-03-02
                        {
                            //writeLog.WriteLogData(new CDBSPMethed().GetConn()); //Add By XKH 2009-03-02 //Remark By Berlin 8/4/2009
                            isSaveKeepLog = true;//Added By Berlin 8/4/2009

                        }

                        this.TagNo2 = this.TagNo1;//Add By XKH 2009-03-02

                        //lblcollectstate.Text = "讀取標簽中...";//Add By XKH 2009-03-02

                        CheckCommand.Transaction.Commit();

                    }
                    catch
                    {
                    }
                    //if (CDBSPMethod != null)
                    //{
                    //    CDBSPMethod.Disconnect();
                    //    CDBSPMethod = null;
                    //}

                    //CDBSPMethod.Dispose();
                    //CheckCommand.Dispose();
                    //dtTable.Dispose();
                    //dvTable.Dispose();
                    //retrieveDataAdapter.Dispose();
                }

            }
        }

        // Method :                       SetOutputSignal
        // Date :                         12/01/2007
        // Description :                  It is to change output signal according to the input
        // input :                        beep - whether beep signal is submitted
        //                                red - whether red color signal is submitted
        //                                amber - whether amber color signal is submitted
        //                                green - whether green color signal is submitted
        // Output :                       null
        private void SetOutputSignal(bool beep, bool red, bool amber, bool green)
        {

            DateTime dtCurrentTime = DateTime.Now;      // The time that start execuation of the procedure - SetOutputSignal
            bool isChangeOutput = false;                // The flag that whether the output signal is submitted to the CSE

            //修改限制兩次SetOutputSignal的時間

 

            //如果兩次SetOutputSignal的時間間隔小於預定值,則會停止線程一定時間後再SetOutput

            TimeSpan diff = DateTime.Now.Subtract(this.dtAnySignal);//减去指定持续的时间 kevenChan

            if (!this.isStartSetOutputSignal ||
                !(beep == this.isBeep && red == this.isRed && amber == this.isAmber && green == this.isGreen))
            {
                if (!(!beep && !red && !amber && !green))
                {
                    this.dtAnySignal = DateTime.Now;

                    this.isStartSetOutputSignal = true;
                    this.isBeep = beep;
                    this.isRed = red;
                    this.isAmber = amber;
                    this.isGreen = green;

                    isChangeOutput = true;
                }
                else
                {

                    if ((1000 - diff.TotalMilliseconds) < 0)//获取整毫秒数以及小数部分表示当前的diff值,被1秒减
                    {
                        this.isStartSetOutputSignal = true;
                        this.isBeep = beep;
                        this.isRed = red;
                        this.isAmber = amber;
                        this.isGreen = green;

                        isChangeOutput = true;
                    }
                }
            }
            else
            {
                if (!(!beep && !red && !amber && !green))
                {
                    this.dtAnySignal = DateTime.Now;
                }
            }

            if (isChangeOutput)
            {
                try
                {
                    if (this.CommandControler != null)
                    {
                        if (this.cboReaderIP.SelectedItem != null && this.cboServerIP.SelectedItem != null)
                        {
                            this.CommandControler.GetExternalOutput(
                             this.strCurIP.Trim(),
                             "changereaderconfig",
                             this.cboReaderIP.SelectedItem.ToString().Trim(),
                             this.cboServerIP.SelectedItem.ToString().Trim(),
                             "10000",
                             beep,
                             red,
                             amber,
                             green);

                            this.dtAnySignal = DateTime.Now;
                        }
                    }
                }
                finally
                {
                    // ********************************************************************
                    // Date : 10/01/2007
                    // Description : It is used to make sure that the execution time of
                    // procedure is within specific interval
                    // intWaitOutputSignalInterval - the time of interval that allow the reader to change output signal
                    //TimeSpan diff = DateTime.Now.Subtract(dtCurrentTime);

                    if ((int)((double)this.intWaitOutputSignalInterval - diff.TotalMilliseconds) > 0)
                    {
                        Thread.Sleep((int)((double)this.intWaitOutputSignalInterval - diff.TotalMilliseconds));
                    }
                    else
                    {
                        Thread.Sleep(1);
                    }

                    // ********************************************************************
                }
            }
        }

        // Method :                       ChangeVisibility
        // Date :                         12/01/2007
        // Description :                  It is to change the interface appearance according to the input
        // Input :                            index (It is mainly come from stored procedure that the interface is displayed)
        // Output :                         null
        private void ChangeVisibility(int index)
        {

            //************ Add By XueKeHuang 2008-10-31 新增小型機台TAG情況 **********Begin
            if (PrexTagNo.ToString().Trim().ToUpper() == "CC")
            {
                if (index == 1)
                {
                    this.SetOutputSignal(false, false, false, true);//綠燈
                }
                else if (index == 0)
                {
                    this.SetOutputSignal(true, true, false, false); //紅燈
                }
                else
                {
                    this.SetOutputSignal(false, false, false, false);//不顯示


                }

                //版面控件的顯示


                if (index == 1)
                {
                    this.lblStatus.Visible = false;
                    this.lblAlertMSG.Visible = true;
                    this.lblTagNo.Visible = true;
                    this.pitLogo.Visible = false;
                    this.BackColor = Color.Green;
                    this.tabPage1.BackColor = Color.Green;
                }
                else if (index == 0)
                {
                    this.lblStatus.Visible = true;
                    this.lblAlertMSG.Visible = true;
                    this.lblTagNo.Visible = true;
                    this.pitLogo.Visible = false;

                    this.BackColor = Color.Red;
                    this.tabPage1.BackColor = Color.Red;
                }
                else
                {
                    this.lblStatus.Visible = false;
                    this.lblAlertMSG.Visible = false;
                    this.lblTagNo.Visible = false;
                    this.pitLogo.Visible = true;
                    this.BackColor = Color.DarkGray;
                    this.tabPage1.BackColor = Color.Transparent;
                }

            }

            else
            {
                //*************************************************************************End
                if (index != this.intCurrentInterface)
                {

                    //Add by RyanYe 06/01/2006
                    //綠燈
                    if (index == 1 || index == 2 || index == 8)
                    {
                        // Description :  It is used to send special command to CSE in order to change tri-color signal
                        //    actionname - the command sent to CSE (the value must be "changereaderconfig")
                        //    readerIP - the ip address of reader that change tri-color signal
                        //    serverIP - the ip address of CSE that currently connected to
                        //    serverPort - the port of CSE that currently connected to
                        //    beep - whether beep signal is submitted
                        //    red - whether red color signal is submitted
                        //    amber - whether amber color signal is submitted
                        //    green - whether green color signal is submitted
                        // Output :   null
                        this.SetOutputSignal(false, false, false, true);
                        //if (this.CommandControler != null)
                        //{
                        //    this.CommandControler.GetExternalOutput(
                        //     this.strCurIP.Trim(),
                        //     "changereaderconfig",
                        //     this.cboReaderIP.SelectedItem.ToString().Trim(),
                        //     this.cboServerIP.SelectedItem.ToString().Trim(),
                        //     "10000",
                        //     false,
                        //     false,
                        //     false,
                        //     true);
                        //}
                    }
                    //黃燈
                    else if (index == 5)
                    {
                        this.SetOutputSignal(false, false, true, false);
                    }
                    //紅燈
                    else if (index == 3 || index == 4 || index == 6)
                    {
                        this.SetOutputSignal(true, true, false, false);
                        //if (this.CommandControler != null)
                        //{
                        //    this.CommandControler.GetExternalOutput(
                        //     this.strCurIP.Trim(),
                        //     "changereaderconfig",
                        //     this.cboReaderIP.SelectedItem.ToString().Trim(),
                        //     this.cboServerIP.SelectedItem.ToString().Trim(),
                        //     "10000",
                        //     true,
                        //     true,
                        //     false,
                        //     false);
                        //}

                    }
                    else
                    {
                        this.SetOutputSignal(false, false, false, false);
                        //if (this.CommandControler != null)
                        //{
                        //    if (this.cboReaderIP.SelectedItem != null && this.cboServerIP.SelectedItem != null)
                        //    {
                        //        this.CommandControler.GetExternalOutput(
                        //         this.strCurIP.Trim(),
                        //         "changereaderconfig",
                        //         this.cboReaderIP.SelectedItem.ToString().Trim(),
                        //         this.cboServerIP.SelectedItem.ToString().Trim(),
                        //         "10000",
                        //         false,
                        //         false,
                        //         false,
                        //         false);
                        //    }
                        //}
                    }

                    if (index == 2)
                    {
                        this.lblJobNo.Visible = true;
                        this.lblCartonQty.Visible = true;
                        this.lblStatus.Visible = true;

                        this.lblAlertMSG.Visible = false;
                        this.lblTagNo.Visible = true;

                        this.pitLogo.Visible = false;
                        this.BackColor = Color.Green;
                        this.tabPage1.BackColor = Color.Green;
                    }
                    else if (index == 3)
                    {
                        this.lblJobNo.Visible = false;
                        this.lblCartonQty.Visible = false;
                        this.lblStatus.Visible = false;

                        this.lblAlertMSG.Visible = true;
                        this.lblTagNo.Visible = true;

                        this.pitLogo.Visible = false;
                        this.BackColor = Color.Red;
                        this.tabPage1.BackColor = Color.Red;
                    }
                    else if (index == 4)
                    {
                        this.lblJobNo.Visible = false;
                        this.lblCartonQty.Visible = false;
                        this.lblStatus.Visible = false;

                        this.lblAlertMSG.Visible = true;
                        this.lblTagNo.Visible = true;

                        this.pitLogo.Visible = false;
                        this.BackColor = Color.Red;
                        this.tabPage1.BackColor = Color.Red;
                    }
                    else if (index == 5)
                    {
                        this.lblJobNo.Visible = true;
                        this.lblCartonQty.Visible = true;
                        this.lblStatus.Visible = true;

                        this.lblAlertMSG.Visible = false;
                        this.lblTagNo.Visible = false;

                        this.pitLogo.Visible = false;
                        this.BackColor = Color.Orange;
                        this.tabPage1.BackColor = Color.Orange;
                    }
                    else if (index == 6)
                    {
                        this.lblJobNo.Visible = false;
                        this.lblCartonQty.Visible = false;
                        this.lblStatus.Visible = true;

                        this.lblAlertMSG.Visible = true;
                        this.lblTagNo.Visible = true;

                        this.pitLogo.Visible = false;
                        this.BackColor = Color.Red;
                        this.tabPage1.BackColor = Color.Red;
                    }
                    else if (index == 8)
                    {
                        this.lblJobNo.Visible = false;
                        this.lblCartonQty.Visible = false;
                        this.lblStatus.Visible = false;

                        this.lblAlertMSG.Visible = true;
                        this.lblTagNo.Visible = true;

                        this.pitLogo.Visible = false;
                        this.BackColor = Color.Green;
                        this.tabPage1.BackColor = Color.Green;
                    }
                    else
                    {
                        this.lblJobNo.Visible = false;
                        this.lblCartonQty.Visible = false;
                        this.lblStatus.Visible = false;

                        this.lblAlertMSG.Visible = false;
                        this.lblTagNo.Visible = false;

                        this.pitLogo.Visible = true;
                        this.BackColor = Color.DarkGray;
                        this.tabPage1.BackColor = Color.Transparent;
                    }

                    //Remark by Ryan 10/01/2007
                    Add by RyanYe 06/01/2006
                    //if (index ==2 || index == 5)
                    //{
                    //    // Description :  It is used to send special command to CSE in order to change tri-color signal
                    //    //    actionname - the command sent to CSE (the value must be "changereaderconfig")
                    //    //    readerIP - the ip address of reader that change tri-color signal
                    //    //    serverIP - the ip address of CSE that currently connected to
                    //    //    serverPort - the port of CSE that currently connected to
                    //    //    beep - whether beep signal is submitted
                    //    //    red - whether red color signal is submitted
                    //    //    amber - whether amber color signal is submitted
                    //    //    green - whether green color signal is submitted
                    //    // Output :   null
                    //    if (this.CommandControler != null)
                    //    {
                    //        this.CommandControler.GetExternalOutput(
                    //         this.strCurIP.Trim(),
                    //         "changereaderconfig",
                    //         this.cboReaderIP.SelectedItem.ToString().Trim(),
                    //         this.cboServerIP.SelectedItem.ToString().Trim(),
                    //         "10000",
                    //         false ,
                    //         false,
                    //         false,
                    //         true );
                    //    }
                    //}
                    //else if (index == 3 || index == 4 || index== 6)
                    //{
                    //    if (this.CommandControler != null)
                    //    {
                    //        this.CommandControler.GetExternalOutput(
                    //         this.strCurIP.Trim(),
                    //         "changereaderconfig",
                    //         this.cboReaderIP.SelectedItem.ToString().Trim(),
                    //         this.cboServerIP.SelectedItem.ToString().Trim(),
                    //         "10000",
                    //         true ,
                    //         true,
                    //         false,
                    //         false);
                    //    }

                    //}
                    //else
                    //{
                    //    if (this.CommandControler != null)
                    //    {
                    //        if (this.cboReaderIP.SelectedItem != null && this.cboServerIP.SelectedItem != null)
                    //        {
                    //            this.CommandControler.GetExternalOutput(
                    //             this.strCurIP.Trim(),
                    //             "changereaderconfig",
                    //             this.cboReaderIP.SelectedItem.ToString().Trim(),
                    //             this.cboServerIP.SelectedItem.ToString().Trim(),
                    //             "10000",
                    //             false,
                    //             false,
                    //             false,
                    //             false);
                    //        }
                    //    }
                    //}

                    //this.Refresh();
                    this.intCurrentInterface = index;
                }
            }
        }

        private void RFReceived(RFActionEventArgs e)
        {
            // The encoding.
            try
            {
                ASCIIEncoding ascii = new ASCIIEncoding();
                ArrayList AL1 = new ArrayList();
                int intC = 0;
                // string strcase = "";
                this.strProcessingType = "";

                string tempResult = ascii.GetString(e.ResultObject).Trim();
                if (this.doc == null)
                {
                    this.doc = new XmlDocument();
                }
                else
                {
                    this.doc.RemoveAll();
                }
                doc.LoadXml(tempResult);
                this.root = doc.DocumentElement;
                //Tag List x-path
                //16/1,06 Emily
                this.nodeList = this.root.SelectNodes("middleware-rfid-exception/reader-exception");
               
              
                if (this.nodeList.Count > 0)
                {
                    #region 如果有异常信息反馈,则显示连接网络准备中
                    this.bTextBox_M1.Clear();
                    foreach (XmlNode ipNode in this.nodeList)
                    {
                        string strReaderIP = ipNode.Attributes["readerip"].Value;
                        string telnetport = ipNode.Attributes["telnetport"].Value;
                        string comport = ipNode.Attributes["comport"].Value;
                        string interfacetype = ipNode.Attributes["interfacetype"].Value;

                        XmlNode messageNode = ipNode.FirstChild;
                        string msgcode = messageNode.Attributes["code"].Value;

                        while (messageNode != null)
                        {
                            XmlNode contentNode = messageNode.FirstChild;

                            while (contentNode != null)
                            {
                                string strContent = contentNode.InnerText;
                                this.bTextBox_M1.AppendText("[" + strContent + "]/n" + "[" + strReaderIP + "]/n" + "[" + telnetport + "]/n" + "[" + comport + "]/n" + "[" + interfacetype + "]/n");
                                contentNode = contentNode.NextSibling;
                                if (this.cboAction.SelectedItem.ToString().Trim().ToUpper().Equals("WRITETAG"))
                                {
                                    this.lblconnecting.Text = "Ready";
                                    this.lblcollectstate.Text = "Ready";//By Eric 26/1/2007
                                }
                                this.timer3.Stop();
                                this.txtTotal.Text = "";
                            }
                            messageNode = messageNode.NextSibling;
                        }
                    }

                    #endregion
                }
                else
                {

                    this.nodeList = this.root.SelectNodes("/middleware-rfid-response/middleware-rfid-tag-list/reader");

                    if (this.nodeList.Count < 1)
                    {
                        #region get reader message-- write tag
                        //get reader message-- write tag    
                        this.nodeList = this.root.SelectNodes("/middleware-rfid-response/middleware-rfid-message/reader-message");
                        if (this.nodeList.Count > 0)
                        {
                            this.blWriteSuccessfully = false;
                            this.bTextBox_M1.Clear();

                            foreach (XmlNode ipNode in this.nodeList)
                            {
                                string strReaderIP = ipNode.Attributes["readerip"].Value;
                                string telnetport = ipNode.Attributes["telnetport"].Value;
                                string comport = ipNode.Attributes["comport"].Value;
                                string interfacetype = ipNode.Attributes["interfacetype"].Value;

                                XmlNode messageNode = ipNode.FirstChild;
                                string msgcode = messageNode.Attributes["code"].Value;

                                while (messageNode != null)
                                {
                                    XmlNode contentNode = messageNode.FirstChild;

                                    while (contentNode != null)
                                    {
                                        string strContent = contentNode.InnerText;
                                        this.bTextBox_M1.AppendText("[" + strContent + "]/n" + "[" + strReaderIP + "]/n" + "[" + telnetport + "]/n" + "[" + comport + "]/n" + "[" + interfacetype + "]/n");
                                        contentNode = contentNode.NextSibling;
                                    }
                                    messageNode = messageNode.NextSibling;//获取紧接在该节点之后的节点
                                }
                            }
                        }
                        else
                        {
                            if (this.nodeList.Count > 0)
                            {
                                this.bTextBox_M1.Clear();

                                foreach (XmlNode ipNode in this.nodeList)
                                {
                                    string strReaderIP = ipNode.Attributes["ip"].Value;
                                    string strReaderPort = ipNode.Attributes["port"].Value;

                                    XmlNode taglistNode = ipNode.FirstChild;
                                    XmlNode antennaNode = taglistNode.FirstChild;

                                    while (antennaNode != null)
                                    {
                                        string strAntSeq = antennaNode.Attributes["seq"].Value;
                                        XmlNode tagidNode = antennaNode.FirstChild;

                                        while (tagidNode != null)
                                        {
                                            string strTagID = tagidNode.InnerText;
                                            this.bTextBox_M1.AppendText("[" + strReaderIP + "][" + strAntSeq + "]" + strTagID + "/n");

                                            tagidNode = tagidNode.NextSibling;
                                        }
                                        antennaNode = antennaNode.NextSibling;
                                    }
                                }
                            }
                            else
                            {
                                //21/1,05 Emily For  login checking and exception
                                this.nodeList = this.root.SelectNodes("/middleware-rfid-response/middleware-rfid-message/server-message");
                                //Login success
                                if (this.nodeList.Count > 0)
                                {
                                    this.bTextBox_M1.Clear();
                                    foreach (XmlNode responseNode in this.nodeList)
                                    {
                                        string strserverip = responseNode.Attributes["serverip"].Value;
                                        string strserverport = responseNode.Attributes["serverport"].Value;

                                        XmlNode messageNode = responseNode.FirstChild;
                                        string msgcode = messageNode.Attributes["code"].Value;

                                        while (messageNode != null)
                                        {
                                            XmlNode contentNode = messageNode.FirstChild;

                                            while (contentNode != null)
                                            {
                                                string strContent = contentNode.InnerText;
                                                this.bTextBox_M1.AppendText("[" + strContent + "]/n");
                                                if (contentNode.Name == "content")
                                                {
                                                    if (strContent.Trim().ToUpper().Equals("LOGIN SERVER SUCCESSFULLY"))
                                                    {
                                                        this.boolLogin = true;
                                                    }
                                                    else
                                                    {
                                                        this.boolLogin = false;
                                                    }
                                                }
                                                contentNode = contentNode.NextSibling;
                                            }
                                            messageNode = messageNode.NextSibling;
                                        }
                                        //Console.WriteLine(tempResult);
                                    }
                                }
                                else
                                {
                                    //server exception--Login fail
                                    this.nodeList = this.root.SelectNodes("/middleware-rfid-response/middleware-rfid-exception/server-exception ");
                                    if (this.nodeList.Count > 0)
                                    {
                                        this.bTextBox_M1.Clear();
                                        foreach (XmlNode responseNode in this.nodeList)
                                        {
                                            string strserverip = responseNode.Attributes["serverip"].Value;
                                            string strserverport = responseNode.Attributes["serverport"].Value;

                                            XmlNode messageNode = responseNode.FirstChild;
                                            string msgcode = messageNode.Attributes["code"].Value;

                                            while (messageNode != null)
                                            {
                                                XmlNode contentNode = messageNode.FirstChild;

                                                while (contentNode != null)
                                                {
                                                    string strContent = contentNode.InnerText;
                                                    if (strContent.ToUpper().Equals("READER NOT AVAILABLE."))
                                                    {
                                                        this.lblconnecting.Text = "Ready";
                                                        this.lblcollectstate.Text = "無法連接讀取器!";//By Eric 26/1/2007
                                                    }
                                                    this.bTextBox_M1.AppendText("[" + strContent + "]/n");
                                                    contentNode = contentNode.NextSibling;
                                                }
                                                messageNode = messageNode.NextSibling;
                                            }
                                            //Console.WriteLine(tempResult);
                                        }
                                    }
                                }//Close else
                            }
                        }
                        #endregion
                    }
                    else
                    {
                        //9/1,06 Emily
                        if (!this.txtTimeOut.Text.Trim().Equals("") && !this.txtReadingFreq.Text.Trim().Equals("") && !this.txtWakeUPCount.Text.Trim().Equals(""))
                        {
                            if (this.PubMethod.CStringChecking(this.txtTimeOut.Text.Trim()) == false && this.PubMethod.CStringChecking(this.txtReadingFreq.Text.Trim()) == false && this.PubMethod.CStringChecking(this.txtWakeUPCount.Text.Trim()) == false)
                            {
                                if (Convert.ToInt32(this.txtTimeOut.Text.Trim()) >= 0 && Convert.ToInt32(this.txtReadingFreq.Text.Trim()) >= 0 && Convert.ToInt32(this.txtWakeUPCount.Text.Trim()) >= 0)
                                {
                                    try
                                    {
                                        //25/11,05 Emily GetTagList Result
                                        this.bTextBox_M1.Clear();
                                        this.timer3.Start();
                                        int intcounter = 1;
                                        DateTime DaTi = DateTime.Now;
                                        foreach (XmlNode ipNode in this.nodeList)
                                        {
                                            string strReaderIP = ipNode.Attributes["ip"].Value;
                                            string strReaderPort = ipNode.Attributes["port"].Value;

                                            XmlNode taglistNode = ipNode.FirstChild;
                                            XmlNode antennaNode = taglistNode.FirstChild;

                                            while (antennaNode != null)
                                            {
                                                string strAntSeq = antennaNode.Attributes["seq"].Value;
                                                XmlNode tagidNode = antennaNode.FirstChild;

                                                while (tagidNode != null)
                                                {
                                                    string strTagID = tagidNode.InnerText.Trim(this.delimiter).Replace(" ", "");
                                                    if (this.cbDisplayResult2.Checked == true)
                                                    {
                                                        this.bTextBox_M1.AppendText("[" + strReaderIP + "][" + strAntSeq + "]" + strTagID + "/n");
                                                    }
                                                    intC = intC + 1;

                                                    //1/12,05 Emily Add the result into tag lifecycle
                                                    //增加Tag資料到trTagLife中

 

                                                    TagReceived taglife = new TagReceived();
                                                    taglife.ReaderIP = strReaderIP;
                                                    taglife.TagID = strTagID;
                                                    taglife.Antseq = strAntSeq;
                                                    taglife.Counter = intcounter;
                                                    taglife.StartTime = DaTi;//.ToString("yyyy/MM/dd HH:mm:ss.ffff");
                                                    taglife.EndTime = DaTi.AddSeconds(Convert.ToInt32(this.txtTimeOut.Text.Trim()));//.ToString("yyyy/MM/dd HH:mm:ss.ffff");


                                                    this.trTagLife.Add(taglife);

                                                    tagidNode = tagidNode.NextSibling;
                                                }
                                                antennaNode = antennaNode.NextSibling;
                                                intcounter = intcounter + 1;
                                            }
                                            //Console.WriteLine(tempResult);
                                        }
                                        this.txtTotal.Text = intC.ToString();
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine(ex.ToString());
                                    }
                                }
                            }
                        }//end else
                    }
                }

                this.DgResult.DataSource = this.trTagLife.TagList().DefaultView;
                this.DgResult.Refresh();

            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
                Console.WriteLine(ex.ToString());
                LogHandler.LogDebugMessage(this.GetType(), "RFReceived", ex);
            }

        }
        private void CommandControler_RFAction(object sender, RFActionEventArgs e)
        {
            this.RFReceived(e);
        }


        private void ChangeBackColor(int index)
        {
            // Problem in Backcolor
            if (index == 0)
            {
                this.BackColor = Color.Red;
            }
            else if (index == 1)
            {
                this.BackColor = Color.Green;
            }
            else if (index == 2)
            {
                this.BackColor = Color.Red;
            }
        }


        public void OnThreadException(object sender, ThreadExceptionEventArgs args)
        {
            Exception e = (Exception)args.Exception;
            LogHandler.LogDebugMessage(this.GetType(), "OnThreadException", e);

            if (sender.GetType().Equals(typeof(Thread)))
            {
                Console.WriteLine("RFIDTestClient, OnThreadException, On Thread Exception!! ID : " + ((Thread)sender).GetHashCode().ToString().Trim());
                Console.WriteLine("RFIDTestClient, OnThreadException, On Thread Exception!! Name : " + ((Thread)sender).Name.Trim());
                Console.WriteLine("RFIDTestClient, OnThreadException, On Thread Exception Message : " + e.Message);

                //Console.WriteLine("RFIDTestClient, OnThreadException, On Thread Exception!! ID : " + ((Thread)sender).GetHashCode().ToString().Trim());
                //Console.WriteLine("RFIDTestClient, OnThreadException, On Thread Exception!! Name : " + ((Thread)sender).Name.Trim());
                //Console.WriteLine("RFIDTestClient, OnThreadException, On Thread Exception Message : " + e.Message);
                ((Thread)sender).Abort();
            }
            else
            {
                Console.WriteLine("RFIDTestClient, OnThreadException, On Thread Exception Message : " + e.Message);
            }


        }
        //modify by eric 18/1/2007
        private void bButton1_Click(object sender, System.EventArgs e)
        {
            this.StartReadTag();
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04
        }

        private void StartReadTag()
        {
            try
            {
                if (this.boolLogin == true)
                {
                    if (this.DtSelectItem.Rows.Count < 1)
                    {
                        MessageBox.Show("Please select all required action command");
                    }
                    else
                    {
                        this.dtTagLife.Clear();
                        this.ChangeVisibility(-1);

                        this.CountdownTimer.Start();
                        this.isStartSetOutputSignal = false;            // Modified at 12/01/2007
                        this.isStartCountdown = false;
                        this.dtCountdown = DateTime.Now;
                        //20/1,05 Emily Start login session

                        //28/12,04 Emily Call DLL
                        if (CommandControler == null)
                        {
                            CommandControler = new CommandControler();
                            //28/12,04 Emily Get DLL RFAction Evnet Result
                            CommandControler.RFAction += new RFActionEventHandler(CommandControler_RFAction);
                        }
                        else if (!this.cboAction.SelectedItem.ToString().Trim().Equals("Login"))
                        {
                            object obj = "";
                            try
                            {
                                int tempc = DtSelectItem.Rows.Count;

                                string xmlDS = DtSelectItem.DataSet.GetXml();

                                obj = CommandControler.GetStart((object)xmlDS);
                                this.timer2.Start();
                                this.lblconnecting.Text = "讀取標簽中";
                                this.lblcollectstate.Text = "讀取標簽中";//20/1/2007 Eric

                                this.lblcollectstate.ForeColor = System.Drawing.Color.Blue;//Add By XKH 2009-04-01

                                this.timer3.Start();
                                if (obj != null && !obj.ToString().Trim().Equals(""))
                                {
                                    System.Xml.XmlDocument objxml = new XmlDocument();
                                    objxml = (XmlDocument)obj;
                                    this.bTextBox_M1.Text = objxml.OuterXml;

                                }
                            }
                            catch (Exception ex)
                            {
                                this.bTextBox_M1.Clear();
                                if (obj != null)
                                {
                                    this.bTextBox_M1.AppendText(obj.ToString().Trim());
                                }

                                Console.WriteLine(ex.ToString());
                            }
                        }
                    }
                }//else true
                else
                {
                    MessageBox.Show("Please login to middleware server when you try to perform any action");
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
                Console.WriteLine(ex.ToString());
            }
        }

        private void checkLogin()
        {
            if (this.boolLogin == true)
            {
                this.cmdlogin.Enabled = false;
            }
            else
            {
                this.cmdlogin.Enabled = true;
            }
        }

        private void RFIDTestClient_Load(object sender, System.EventArgs e)
        {
            this.strCurIP = GetCurrentIP.GetLocalIP();
            this.PubMethod = new CPubMethod();
            this.Chg_Lang();
            this.scatterBlank();
            this.timer1.Start();

            //this.tabControl1.TabPages.Remove(this.tabPage2);      //gary remarked

            // Modified
            //this.CountdownTimer.Start();

            //18/1/2007 eric
            //*****************************
            if (this.strAutoLogin == "1")
            {
                this.AutoLogin();
            }
            //******************************

            //7/6/2007 eric 非live環境時顯示服務器名稱
            if (AppConfig.GetValue("COMMON_PROFILE_DB_IP").ToUpper() != "HSSQL01")
            {
                this.Text = this.Text + AppConfig.GetValue("COMMON_PROFILE_DB_IP").ToUpper();
            }

        }
       
        /// <summary>
        /// 当strlang为English时,英文显示界面标题;当"简体"。。。。。
        /// </summary>
        private void Chg_Lang()
        {
            if (this.strlang.Equals("English"))
            {
                this.lblaction.Text = "Command:";
                this.lblSIP.Text = "Server IP:";
                this.lblANtSeq.Text = "Ant Seq:";
                this.lblMode.Text = "Mode:";
                this.lblReaderIP.Text = "Reader IP:";
                this.lblport.Text = "Port:";
                this.lblcomreq.Text = "Command Request:";
                this.cmdadd.Text = "2 Add";
                this.cmdlogin.Text = "1 Login";
                this.cmdstart.Text = "3 Send and Start";
                this.cmdcancel.Text = "Cancel";
                this.cmdCloseConnection.Text = "Close Connection";
                this.cmdDelete.Text = "Delete";
                this.ActionBox.Text = "Action Commamd";
                this.groupBox1.Text = "Command And Result";
                this.lblresult.Text = "Result:";
                this.cbDisplayResult.Text = "Display Result";
                this.cbDisplayResult2.Text = "Display Result";
                this.bImageButton1.Text = "Reset";
                this.groupBox3.Text = "Client Command";
            }
            else if (this.strlang.Equals("简体"))
            {
                this.lblaction.Text = "指令:";
                this.lblSIP.Text = "伺服器位址:";
                this.lblANtSeq.Text = "天线次序:";
                this.lblMode.Text = "选取形式:";
                this.lblReaderIP.Text = "阅读器位址:";
                this.lblport.Text = "通讯端口:";
                this.lblcomreq.Text = "要求指令:";
                this.cmdDelete.Text = "删除:";
                this.cmdadd.Text = "2 新增";
                this.cmdlogin.Text = "1 登入";
                this.cmdstart.Text = "3 新增及开始";
                this.cmdcancel.Text = "取消";
                this.cmdCloseConnection.Text = "终止连结";
                this.bImageButton1.Text = "重设";
                this.ActionBox.Text = "行动指令";
                this.groupBox1.Text = "指令及回复";
                this.lblresult.Text = "回复:";
                this.cbDisplayResult.Text = "展示";
                this.cbDisplayResult2.Text = "展示";
                this.groupBox3.Text = "客户指令";
            }
            else if (this.strlang.Equals("繁體"))
            {
                this.lblaction.Text = "指令:";
                this.lblSIP.Text = "服務器地址:";
                this.lblANtSeq.Text = "天線次序:";
                this.lblMode.Text = "選擇形式:";
                this.lblReaderIP.Text = "讀取器地址:";
                this.lblport.Text = "通訊端口:";
                this.lblcomreq.Text = "要求指令:";
                this.cmdDelete.Text = "&D 刪除:";
                this.cmdadd.Text = "&A 新增";
                this.cmdlogin.Text = "&L 登入";
                this.cmdstart.Text = "&S 發送指令";
                this.cmdcancel.Text = "&C 取消";
                this.cmdCloseConnection.Text = "&E 終止連接";
                this.bImageButton1.Text = "重設";
                this.ActionBox.Text = "行動指令";
                this.groupBox1.Text = "指令及回復";
                this.lblresult.Text = "回復:";
                this.cbDisplayResult.Text = "展示";
                this.cbDisplayResult2.Text = "展示";
                this.groupBox3.Text = "客戶指令";
            }
        }
        private void scatterBlank()
        {
            this.trTagLife = new TagReceivedList();
            this.JobNoList = new JobNoFloorList();

            this.lblconnecting.Text = "Ready";
            this.lblcollectstate.Text = "Ready";//20/1/2007 Eric
            this.blWriteSuccessfully = false;
            this.cboMode.Items.Clear();
            this.cboMode.Items.Add("I");
            this.cboMode.Items.Add("A");
            this.cboMode.SelectedIndex = 1;
            this.cboServerIP.Items.Clear();

            this.trTagLife = new TagReceivedList();
            this.JobNoList = new JobNoFloorList();

            //Add by Ryan 2007/01/01
            this.ChangeVisibility(-1);

            // *************************************************
            // Description : It is used to reset the intervalof the timer according to the specific variable
            // Date : 12/01/2007
            this.timer2.Interval = this.intTimer2Interval;
            this.CountdownTimer.Interval = this.intCountdownInterval;
            // *************************************************

            for (int i = 0; i < this.ALServerIP.Count; i++)
            {
                this.cboServerIP.Items.Add(this.ALServerIP[i].ToString().Trim());
            }
            this.cboServerIP.SelectedItem = this.strServerIP.Trim();
            this.DgSelect.DataSource = null;
            this.DsSelectItem = null;
            this.DtSelectItem = null;


            this.dtResult = new DataTable();
            this.dtResult.Columns.Add(new DataColumn("ReaderIP", typeof(string)));
            this.dtResult.Columns.Add(new DataColumn("AntSeq", typeof(string)));
            this.dtResult.Columns.Add(new DataColumn("TagID", typeof(string)));

            //1/12,05 Emily
            this.dtTagLife = new DataTable();
            this.dtTagLife.Columns.Add(new DataColumn("TagID", typeof(string)));
            this.dtTagLife.Columns.Add(new DataColumn("Counter", typeof(string)));
            this.dtTagLife.Columns.Add(new DataColumn("AntSeq", typeof(string)));
            this.dtTagLife.Columns.Add(new DataColumn("StartTime", typeof(string)));
            this.dtTagLife.Columns.Add(new DataColumn("EndTime", typeof(string)));
            this.dtTagLife.Columns.Add(new DataColumn("ReaderIP", typeof(string)));

            this.DgResult.DataSource = this.dtTagLife;
            this.SetGridLayout();

            // Modified
            this.dtjobNo = new DataTable("JobNo");
            this.dtjobNo.Columns.Add(new DataColumn("JobNo", typeof(string)));
            this.dtjobNo.Columns.Add(new DataColumn("DiscoveryTime", typeof(DateTime)));
            this.dtjobNo.Columns.Add(new DataColumn("LastSeenTime", typeof(DateTime)));
            this.dtjobNo.Columns.Add(new DataColumn("Interface", typeof(int)));
            this.dtjobNo.Columns.Add(new DataColumn("CartonQty", typeof(int)));
            this.dtjobNo.Columns.Add(new DataColumn("BackColor", typeof(int)));
            this.dtjobNo.Columns.Add(new DataColumn("AlertMSG", typeof(string)));
            this.dtjobNo.Columns.Add(new DataColumn("TagNo", typeof(string)));
            this.dtjobNo.Columns.Add(new DataColumn("InOutStatus", typeof(string)));
            this.dtjobNo.Columns.Add(new DataColumn("PilotLampColor", typeof(int)));
            this.dtjobNo.Columns.Add(new DataColumn("SoundMSG", typeof(int)));
            this.dtjobNo.Columns.Add(new DataColumn("Shown", typeof(int)));
            this.dtjobNo.Columns.Add(new DataColumn("ShownOrder", typeof(int))); //Add By Eric 6/3/2007


            //17/3,05 Emily
            // Create a DataSet.
            this.DsSelectItem = new DataSet("DsSelectItem");
            // Create two DataTables.
            this.DtSelectItem = new DataTable("DtSelectItem");
            DataColumn ReaderIP = new DataColumn("ReaderIP", typeof(string));
            DataColumn Action = new DataColumn("Action", typeof(string));
            DataColumn AntSeq = new DataColumn("AntSeq", typeof(string));
            DataColumn CIP = new DataColumn("CIP", typeof(string));
            DataColumn Mode = new DataColumn("Mode", typeof(string));
            DataColumn Port = new DataColumn("Port", typeof(string));
            DataColumn SIP = new DataColumn("SIP", typeof(string));
            DataColumn Attenuation = new DataColumn("Attenuation", typeof(string));
            DtSelectItem.Columns.Add(ReaderIP);
            DtSelectItem.Columns.Add(Action);
            DtSelectItem.Columns.Add(AntSeq);
            DtSelectItem.Columns.Add(CIP);
            DtSelectItem.Columns.Add(Mode);
            DtSelectItem.Columns.Add(Port);
            DtSelectItem.Columns.Add(SIP);
            DtSelectItem.Columns.Add(Attenuation);
            this.DsSelectItem.Tables.Add(DtSelectItem);
            this.DgSelect.DataSource = this.DtSelectItem;
            //17/1,06 Emily
            this.DgSelect.TableStyles.Clear();
            DataGridTableStyle ts2 = new DataGridTableStyle();
            ts2.MappingName = this.DtSelectItem.TableName;
            // Set other properties.
            ts2.AlternatingBackColor = Color.LightGray;
            //{
            DataGridColumnStyle Col21 = new DataGridTextBoxColumn();
            Col21.MappingName = "ReaderIP";
            Col21.HeaderText = "ReaderIP";
            Col21.Width = 120;
            Col21.ReadOnly = false;
            ts2.GridColumnStyles.Add(Col21);

            DataGridColumnStyle Col22 = new DataGridTextBoxColumn();
            Col22.MappingName = "Action";
            Col22.HeaderText = "Action";
            Col22.Width = 80;
            Col22.ReadOnly = true;
            ts2.GridColumnStyles.Add(Col22);

            DataGridColumnStyle Col23 = new DataGridTextBoxColumn();
            Col23.MappingName = "AntSeq";
            Col23.HeaderText = "AntSeq";
            Col23.Width = 60;
            Col23.ReadOnly = true;
            ts2.GridColumnStyles.Add(Col23);

            DataGridColumnStyle Col24 = new DataGridTextBoxColumn();
            Col24.MappingName = "CIP";
            Col24.HeaderText = "Client IP";
            Col24.Width = 120;
            Col24.ReadOnly = true;
            ts2.GridColumnStyles.Add(Col24);

            DataGridColumnStyle Col25 = new DataGridTextBoxColumn();
            Col25.MappingName = "Mode";
            Col25.HeaderText = "Mode";
            Col25.Width = 20;
            Col25.ReadOnly = true;
            ts2.GridColumnStyles.Add(Col25);

            DataGridColumnStyle Col26 = new DataGridTextBoxColumn();
            Col26.MappingName = "Port";
            Col26.HeaderText = "Port";
            Col26.Width = 30;
            Col26.ReadOnly = true;
            ts2.GridColumnStyles.Add(Col26);

            DataGridColumnStyle Col27 = new DataGridTextBoxColumn();
            Col27.MappingName = "SIP";
            Col27.HeaderText = "Server IP";
            Col27.Width = 120;
            Col27.ReadOnly = true;
            ts2.GridColumnStyles.Add(Col27);

            DataGridColumnStyle Col28 = new DataGridTextBoxColumn();
            Col28.MappingName = "Attenuation";
            Col28.HeaderText = "Attenuation";
            Col28.Width = 80;
            Col28.ReadOnly = true;
            ts2.GridColumnStyles.Add(Col28);
            /* Add the DataGridTableStyle instances to
                the GridTableStylesCollection. */
            this.DgSelect.TableStyles.Add(ts2);
            this.DgSelect.AllowDrop = false;
            this.PubMethod.SetDataGridProperty(this.DgSelect);
            //
            //25/11,05 Emily Get assigned Server IP
            System.Data.SqlClient.SqlDataAdapter DaAllowAction;
            System.Data.DataSet DsAllowAction;
            this.DBMiddlewareMethod = new RFIDClient.Common.Utilities.CDBMiddlewareMethod();
            this.FilteringParaHT = new Hashtable();
            this.ReadCountHT = new Hashtable();
            this.WakeUpHT = new Hashtable();
            this.MultiRecordHT = new Hashtable();
            try
            {
                this.DBMiddlewareMethod.Connect();
                System.Data.SqlClient.SqlCommand RetriveClientCommand;
                System.Data.SqlClient.SqlDataReader RetriveClientReader;
                RetriveClientCommand = new System.Data.SqlClient.SqlCommand();
                DaAllowAction = new System.Data.SqlClient.SqlDataAdapter();
                DsAllowAction = new System.Data.DataSet();
                RetriveClientCommand.CommandText = "SELECT DISTINCT [Reader IP],FilteringParameter,ReadCount,WakeUpCount FROM ReaderMaster where [Client IP] = RTRIM(@ClientIP)";
                RetriveClientCommand.Parameters.Add("@ClientIP", System.Data.SqlDbType.VarChar);
                RetriveClientCommand.Parameters["@ClientIP"].Value = GetCurrentIP.GetLocalIP();
                RetriveClientCommand.Connection = this.DBMiddlewareMethod.GetConn();

                RetriveClientReader = RetriveClientCommand.ExecuteReader();
                this.cboReaderIP.Items.Clear();
                while (RetriveClientReader.Read())
                {
                    if (!this.cboReaderIP.Items.Contains(RetriveClientReader.GetString(0).Trim()))
                    {
                        this.cboReaderIP.Items.Add(RetriveClientReader.GetString(0).Trim());
                    }
                    FilteringParaHT.Add(RetriveClientReader.GetString(0), RetriveClientReader.GetInt16(1));
                    ReadCountHT.Add(RetriveClientReader.GetString(0), RetriveClientReader.GetInt16(2));
                    WakeUpHT.Add(RetriveClientReader.GetString(0), RetriveClientReader.GetInt16(3));
                }
                RetriveClientReader.Close();

                try
                {
                    RFIDClient.Common.Utilities.DBMethod DBMethod;
                    this.cboAction.Items.Clear();
                    DBMethod = new DBMethod();
                    try
                    {
                        //23/11,05 Emily            
                        DBMethod.Connect();

                        System.Data.SqlClient.SqlCommand RetriveAllowActionCommand;
                        System.Data.SqlClient.SqlDataReader RetriveAllowActionReader;
                        ArrayList ActionArray = new ArrayList();

                        RetriveAllowActionCommand = new System.Data.SqlClient.SqlCommand();
                        DaAllowAction = new System.Data.SqlClient.SqlDataAdapter();
                        DsAllowAction = new System.Data.DataSet();
                        RetriveAllowActionCommand.CommandText = "SELECT ActionCode FROM ClientProfile_AllowAction where ClientIP = RTRIM(@ClientIP)";
                        RetriveAllowActionCommand.Parameters.Add("@ClientIP", System.Data.SqlDbType.VarChar);
                        RetriveAllowActionCommand.Parameters["@ClientIP"].Value = this.strCurIP;
                        RetriveAllowActionCommand.Connection = DBMethod.GetConn();

                        RetriveAllowActionReader = RetriveAllowActionCommand.ExecuteReader();

                        while (RetriveAllowActionReader.Read())
                        {
                            this.cboAction.Items.Add(RetriveAllowActionReader.GetString(0).Trim());
                        }
                        RetriveAllowActionReader.Close();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        DBMethod.Disconnect();
                    }
                    finally
                    {
                        DBMethod.Disconnect();
                    }
                    this.cboAction.SelectedIndex = 0;
                }

                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    DBMethod.Disconnect();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                this.DBMiddlewareMethod.Disconnect();
            }
            finally
            {
                this.DBMiddlewareMethod.Disconnect();
            }
            if (this.cboReaderIP.Items.Count > 0)
            {
                this.cboReaderIP.SelectedIndex = 0;
            }
            this.txtTimeOut.Text = this.intFilteringParameter.ToString();
            this.txtReadingFreq.Text = this.intReadingFrequency.ToString();
            //
        }
        private void GetParaFromDB()
        {
            try
            {
                this.DBMiddlewareMethod.Disconnect();
                this.DBMiddlewareMethod = new RFIDClient.Common.Utilities.CDBMiddlewareMethod();
                this.FilteringParaHT = new Hashtable();
                this.ReadCountHT = new Hashtable();
                this.WakeUpHT = new Hashtable();
                this.MultiRecordHT = new Hashtable();
                this.DBMiddlewareMethod.Connect();
                System.Data.SqlClient.SqlCommand RetriveClientCommand;
                System.Data.SqlClient.SqlDataReader RetriveClientReader;
                System.Data.SqlClient.SqlDataReader GetServerIPReader;
                System.Data.SqlClient.SqlCommand GetServerIPCommand;
                RetriveClientCommand = new System.Data.SqlClient.SqlCommand();
                RetriveClientCommand.CommandText = "SELECT DISTINCT [Reader IP],FilteringParameter,ReadCount,WakeUpCount,MultiRecord FROM ReaderMaster where [Client IP] = RTRIM(@ClientIP)";
                RetriveClientCommand.Parameters.Add("@ClientIP", System.Data.SqlDbType.VarChar);
                RetriveClientCommand.Parameters["@ClientIP"].Value = GetCurrentIP.GetLocalIP();
                RetriveClientCommand.Connection = this.DBMiddlewareMethod.GetConn();

                RetriveClientReader = RetriveClientCommand.ExecuteReader();
                this.cboReaderIP.Items.Clear();
                while (RetriveClientReader.Read())
                {
                    if (!this.cboReaderIP.Items.Contains(RetriveClientReader.GetString(0).Trim()))
                    {
                        this.cboReaderIP.Items.Add(RetriveClientReader.GetString(0).Trim());
                    }
                    FilteringParaHT.Add(RetriveClientReader.GetString(0), RetriveClientReader.GetInt16(1));
                    ReadCountHT.Add(RetriveClientReader.GetString(0), RetriveClientReader.GetInt16(2));
                    WakeUpHT.Add(RetriveClientReader.GetString(0), RetriveClientReader.GetInt16(3));
                    MultiRecordHT.Add(RetriveClientReader.GetString(0), RetriveClientReader.GetString(4));
                }
                this.DBMethod = new DBMethod();
                this.DBMethod.Connect();
                string CheckSql = "SELECT serverip FROM ServerProfile";
                GetServerIPCommand = new System.Data.SqlClient.SqlCommand();
                GetServerIPCommand.CommandText = CheckSql;
                GetServerIPCommand.Connection = this.DBMiddlewareMethod.GetConn();
                GetServerIPReader = GetServerIPCommand.ExecuteReader();
                this.cboServerIP.Items.Clear();
                while (GetServerIPReader.Read())
                {
                    this.cboServerIP.Items.Add(GetServerIPReader.GetString(0).Trim());
                }
                this.cboServerIP.SelectedItem = this.strServerIP.Trim();
                GetServerIPReader.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                DBMethod.Disconnect();
                this.DBMiddlewareMethod.Disconnect();
            }
            finally
            {
                DBMethod.Disconnect();
                this.DBMiddlewareMethod.Disconnect();
            }
        }

        private void ClosConnection()
        {
            if (this.CommandControler != null)
            {
                CommandControler.ClosConnection();
                this.CommandControler = null;
                this.DBMethod.Disconnect();
            }
            if (this.CommandControler == null)
            {
                this.bTextBox_M1.Text = "Connection Close";
            }
            if (this.doc != null)
            {
                this.doc = null;
            }
        }
        private void cmdCloseConnection_Click(object sender, System.EventArgs e)
        {
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04

            try
            {
                // Modified
                this.CountdownTimer.Stop();
                this.isStartSetOutputSignal = false;        // Modified at 12/01/2007
                this.isStartCountdown = false;
                this.dtCountdown = DateTime.Now;

                // ***********************************************************
                // Description : It is used to reset the output signal before disconnect to CSE
                // Modified at 12/01/2007
                try
                {
                    if (this.CommandControler != null)
                    {
                        if (this.cboReaderIP.SelectedItem != null && this.cboServerIP.SelectedItem != null)
                        {
                            this.CommandControler.GetExternalOutput(
                             this.strCurIP.Trim(),
                             "changereaderconfig",
                             this.cboReaderIP.SelectedItem.ToString().Trim(),
                             this.cboServerIP.SelectedItem.ToString().Trim(),
                             "10000",
                             false,
                             false,
                             false,
                             false);
                        }
                    }
                }
                finally
                {
                    Thread.Sleep(1500);
                }
                // ***********************************************************

                this.ClosConnection();
                this.timer3.Stop();
                this.lblconnecting.Text = "Ready";
                this.lblcollectstate.Text = "Ready";//20/1/2007 Eric
                this.boolLogin = false;
                this.cmdstart.Enabled = true;
                this.scatterBlank();
            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }
        }

        private void cmdadd_Click(object sender, System.EventArgs e)
        {
            this.commandAdd();
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04
        }

        private void commandAdd()
        {
            try
            {
                if (this.cboAction.SelectedItem.ToString().Trim().ToUpper().Equals("WRITETAG"))
                {
                    MessageBox.Show("Please use individual write tag module to perform write tag");
                }
                else
                {
                    DataRow newRow1;
                    if (this.DsSelectItem == null)
                    {
                        // Create a DataSet.
                        this.DsSelectItem = new DataSet("DsSelectItem");
                        this.DsSelectItem.Tables.Add(DtSelectItem);
                    }
                    newRow1 = this.DtSelectItem.NewRow();
                    newRow1[0] = this.cboReaderIP.SelectedItem.ToString().Trim();
                    newRow1[1] = this.cboAction.SelectedItem.ToString().Trim();
                    newRow1[2] = this.txtAntSeq.Text.Trim();
                    newRow1[3] = this.strCurIP.Trim();
                    newRow1[4] = this.cboMode.SelectedItem.ToString().Trim();
                    newRow1[5] = this.txtport.Text.Trim();
                    newRow1[6] = this.cboServerIP.SelectedItem.ToString().Trim();
                    newRow1[7] = this.txtrfattenuation.Text.Trim();
                    this.DtSelectItem.Rows.Add(newRow1);
                    this.DgSelect.DataSource = this.DtSelectItem;
                }
            }
            catch (Exception ex)
            {
                LogHandler.LogDebugMessage(this.GetType(), "commandAdd", ex);
            }

        }

        private void cmdcancel_Click(object sender, System.EventArgs e)
        {
            this.bTextBox_M1.Text = "";
            this.scatterBlank();
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04
        }

        private void cmdlogin_Click(object sender, System.EventArgs e)
        {
            //this.cmdlogin.Enabled = false;
            //this.boolLogin = true;
            this.loginprogress(this.cboServerIP.SelectedItem.ToString().Trim());
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04
        }
        private void loginprogress(string tempServerIP)
        {
            //21/1,05 Emily   
            CommandControler = new CommandControler(false);
            //28/12,04 Emily Get DLL RFAction Evnet Result
            CommandControler.RFAction += new RFActionEventHandler(CommandControler_RFAction);
            this.loginResult = CommandControler.Login(this.strCurIP.Trim(), "login", tempServerIP, "10000", this.username.Trim(), this.psd.Trim());
            if (this.loginResult.Trim() != "")
            {
                this.bTextBox_M1.Clear();
                this.bTextBox_M1.AppendText(this.loginResult);
            }
        }
        private void bExitButton1_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }

        private void cmdExternalOutput_Click(object sender, System.EventArgs e)
        {
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04

            //23/11, 2005
            string straction = this.cboAction.SelectedItem.ToString().Trim();
            if (straction.Trim() == "changereaderconfig")
            {
                string strwritetagIP = this.cboReaderIP.SelectedItem.ToString().Trim();
                string strclientip = this.strCurIP.Trim();
                string strsdrverip = this.cboServerIP.SelectedItem.ToString().Trim();
                string strserverport = this.txtport.Text.Trim();

                if (CommandControler == null)
                {
                    CommandControler = new CommandControler();
                    //28/12,04 Emily Get DLL RFAction Evnet Result
                    CommandControler.RFAction += new RFActionEventHandler(CommandControler_RFAction);
                }
                CommandControler.GetExternalOutput(strclientip, "changereaderconfig", strwritetagIP, strsdrverip, strserverport, true, true, true, false);
            }
            else
            {
                MessageBox.Show("Please select action to change reader config");
            }
        }

        private void timer1_Tick(object sender, System.EventArgs e)
        {
            this.txtCurrentDateTime.Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
            this.checkLogin();
        }

        private void timer2_Tick(object sender, System.EventArgs e)
        {
            DateTime dtCurrentTime = DateTime.Now;

            CheckNet();//Add By XKH 2009-05-04

            try
            {
                lblcollectstate.Text = "讀取標簽中...";//Add By XKH 2009-03-02
                this.lblcollectstate.ForeColor = System.Drawing.Color.Blue;//Add By XKH 2009-04-01

                //<<<<<<<<<<<<Modify By XKH 2009-07-30
                //HandleReseivedTag();
                if (IsInput)
                    HandleInputTag();
                else
                    HandleReseivedTag();
                //>>>>>>>>>>>>End

                this.lblcollectstate.ForeColor = System.Drawing.Color.Blue;//Add By Berlin 8/4/2009
                lblcollectstate.Text = "讀取標簽中.";//Added By Berlin 8/4/2009
                writeLog.ApAddress = DateTime.Now.ToString();//Added By Berlin 8/4/2009

                HandleTagDisplay();

                writeLog.Ap2Address = DateTime.Now.ToString();//Added By Berlin 8/4/2009
                if (isSaveKeepLog)//Added By Berlin 8/4/2009
                    writeLog.WriteLogData(new CDBSPMethed().GetConn());//Added By Berlin 8/4/2009
            }
            catch (Exception ex)
            {
                LogHandler.LogDebugMessage(this.GetType(), "timer2_Tick", ex);
            }

            // ********************************************************************
            // Date : 10/01/2007
            // Description : It is used to make sure that the execution time of
            // procedure is within specific interval
            TimeSpan diff = DateTime.Now.Subtract(dtCurrentTime);

            if ((int)((double)this.intTimer2Interval - diff.TotalMilliseconds) > 0)
            {
                try
                {
                    this.timer2.Interval = (int)((double)this.intTimer2Interval - diff.TotalMilliseconds) + 1;
                }
                catch (Exception ex)
                {
                    LogHandler.LogDebugMessage(this.GetType(), "timer2_Tick", ex);
                }
            }
            else
            {
                this.timer2.Interval = 1;
            }

            // ********************************************************************

        }

        private void HandleReseivedTag()
        {
            CDBSPMethed CDBSPMethod = null;

            if (!this.strProcessingType.Trim().Equals("writetag"))
            {
                if (!this.txtTimeOut.Text.Trim().Equals("") && !this.txtReadingFreq.Text.Trim().Equals("") && !this.txtWakeUPCount.Text.Trim().Equals(""))
                {
                    if (this.PubMethod.CStringChecking(this.txtTimeOut.Text.Trim()) == false && this.PubMethod.CStringChecking(this.txtReadingFreq.Text.Trim()) == false && this.PubMethod.CStringChecking(this.txtWakeUPCount.Text.Trim()) == false)
                    {
                        if (Convert.ToInt32(this.txtTimeOut.Text.Trim()) >= 0 && Convert.ToInt32(this.txtReadingFreq.Text.Trim()) >= 0 && Convert.ToInt32(this.txtWakeUPCount.Text.Trim()) >= 0)
                        {
                            try
                            {
                                lock (this.trTagLife)
                                {
                                    this.intReadingFrequency = Convert.ToInt32(this.txtReadingFreq.Text.Trim());


                                    bool okinsert = true;

                                    TagReceived[] trTagList = this.trTagLife.TagList(this.intReadingFrequency);

                                    if (trTagList != null)
                                    {
                                        foreach (TagReceived trTag in trTagList)
                                        {
                                            lblcollectstate.Text = trTag.TagID;//Added By BerlinLiu 9/4/2009
                                            string strTagID = trTag.TagID.Trim(this.delimiter).Replace(" ", "");

                                            lblcollectstate.Text = "讀到標簽...";//Add By XKH 2009-03-02

                                            this.lblcollectstate.ForeColor = System.Drawing.Color.Blue;//Add By XKH 2009-04-01

                                            this.writeLog = new WriteLog(username);//Add By XKH 2009-03-02
                                            writeLog.InitEndReadTagData();//Add By XKH 2009-03-02 新增LOG記錄


                                            08/06/2007 Check Existing Tag ID
                                            //如果前綴不是“AA”及“BB”卡板標簽時,不作處理。

 

                                            //15/06/2007 增加處理測試Tag

                                            //************** Modify By XueKeHuang 2008-10-31 增中小型機台的標簽CC開頭 *******************
                                            //if (strTagID.Substring(0, 2).ToUpper() == "AA" || strTagID.Substring(0, 2).ToUpper() == "BB" || strTagID == "FFFFFFFFFFFFFFFFFFFFFFFE")
                                            if (strTagID.Substring(0, 2).ToUpper() == "AA" || strTagID.Substring(0, 2).ToUpper() == "BB" || strTagID.Substring(0, 2).ToUpper() == "CC" || strTagID == "FFFFFFFFFFFFFFFFFFFFFFFE")
                                            {
                                                okinsert = true;
                                                PrexTagNo = strTagID.Substring(0, 2).ToUpper();//Add By XueKeHuang 2008-10-31 標簽前綴
                                            }
                                            else
                                            {
                                                okinsert = false;
                                            }

                                            if (okinsert == true)
                                            {

                                                writeLog.InitStatSQLData();//Add By XKH 2009-03-02 新增LOG記錄

                                                lblcollectstate.Text = "數據正在處理中...";//Added By BerlinLiu 24/02/2009

                                                this.lblcollectstate.ForeColor = System.Drawing.Color.Red;//Add By XKH 2009-04-01

                                                if (CDBSPMethod == null)
                                                {

                                                    //**** Add By XueKeHuang 2008-10-31 增中小型機台 ************BEGIN
                                                    if (PrexTagNo.ToString().Trim() == "CC")
                                                        CDBSPMethod = new CDBSPMethed("LEMSDB");
                                                    else
                                                        // **********************************************************END
                                                        CDBSPMethod = new CDBSPMethed();
                                                }


                                                lblTagCount.Text = (int.Parse(lblTagCount.Text) + 1).ToString();//15/04/2009 測試讀取標簽的次數
                                                writeLog.InitEndFristSQLData();//Add By XKH 2009-02-20 新增LOG記錄
                                                //if (JobNoList.Exist(TagHandleMethod.RemodelATagNo(strTagID)) == -1)//Added By BerlinLiu 15/4/2009 增加性能優化,如果已經存此Tag,則不需要再做任何操作(包括去DB拿資料)
                                                this.DisplayByTagID(strTagID, CDBSPMethod);
                                            }
                                        }
                                    }

                                    trTagLife.RemoveBefore(DateTime.Now);
                                }
                            }
                            catch (Exception ex)
                            {
                                LogHandler.LogDebugMessage(this.GetType(), "HandleReseivedTag", ex);
                            }

                            finally
                            {
                                if (CDBSPMethod != null)
                                {
                                    try
                                    {
                                        CDBSPMethod.Disconnect();
                                        CDBSPMethod = null;
                                    }

                                    catch (Exception ex)
                                    {
                                        LogHandler.LogDebugMessage(this.GetType(), "HandleReseivedTag", ex);
                                    }
                                }
                            }

                        }
                    }
                }
            }
        }

        private void HandleTagDisplay()
        {


            try
            {
                int intCountdownSec = this.GetMainInterfaceInterval() * 1000;
                lock (this.JobNoList)
                {
                    if (this.isStartCountdown)
                    {


                        TimeSpan diff = DateTime.Now.Subtract(this.dtCountdown);

                        // Variable :       intCountdownSec
                        // Description :    It is the time to return to main interface
                        //                  And also reset data table to count down again
                        if ((diff.TotalMilliseconds > (double)intCountdownSec))
                        {
                            // Reset the interface to main interface

                            this.ChangeVisibility(-1);
                            //this.intCurrentInterface = -1;

                            this.lblJobNo.Text = "";
                            this.lblCartonQty.Text = "";
                            this.lblStatus.Text = "";
                            this.lblAlertMSG.Text = "";
                            this.lblTagNo.Text = "";

                            this.isStartCountdown = false;
                            this.dtCountdown = DateTime.Now;

                        }
                    }
                    else
                    {
                        this.ChangeVisibility(-1);              // Modified at 12/01/2007

                        //DataView dv = this.dtjobNo.DefaultView;
                        //dv.RowFilter = "";


                        if (this.JobNoList.Count > 0)
                        {

                            if (!this.CheckExistingTagInfo())
                            {

                                this.DisplayNewTagInfo();
                            }

                            this.isStartCountdown = true;
                            this.dtCountdown = DateTime.Now;
                        }


                    }
                    //this.DisplayNewTagInfo();//Added By Berlin 9/4/2009

                }
            }
            catch (Exception ex)
            {
                LogHandler.LogDebugMessage(this.GetType(), "HandleTagDisplay", ex);
            }
        }
        //private void timer2_Tick(object sender, System.EventArgs e)
        //{
        //    DateTime dtCurrentTime = DateTime.Now;
        //    CDBSPMethed CDBSPMethod = null;

        //    if (!this.strProcessingType.Trim().Equals("writetag"))
        //    {
        //        if (!this.txtTimeOut.Text.Trim().Equals("") && !this.txtReadingFreq.Text.Trim().Equals("") && !this.txtWakeUPCount.Text.Trim().Equals(""))
        //        {
        //            if (this.PubMethod.CStringChecking(this.txtTimeOut.Text.Trim()) == false && this.PubMethod.CStringChecking(this.txtReadingFreq.Text.Trim()) == false && this.PubMethod.CStringChecking(this.txtWakeUPCount.Text.Trim()) == false)
        //            {
        //                if (Convert.ToInt32(this.txtTimeOut.Text.Trim()) >= 0 && Convert.ToInt32(this.txtReadingFreq.Text.Trim()) >= 0 && Convert.ToInt32(this.txtWakeUPCount.Text.Trim()) >= 0)
        //                {
        //                    try
        //                    {
        //                        this.intReadingFrequency = Convert.ToInt32(this.txtReadingFreq.Text.Trim());


        //                        bool okinsert = true;

        //                        TagReceived[] trTagList = this.trTagLife.TagList(this.intReadingFrequency);

        //                        if (trTagList != null)
        //                        {
        //                            foreach (TagReceived trTag in trTagList)
        //                            {
        //                                string strTagID = trTag.TagID.Trim(this.delimiter).Replace(" ", "");


        //                                08/06/2007 Check Existing Tag ID
        //                                //如果前綴不是“AA”及“BB”卡板標簽時,不作處理。

 

        //                                //15/06/2007 增加處理測試Tag
        //                                if (strTagID.Substring(0, 2).ToUpper() == "AA" || strTagID.Substring(0, 2).ToUpper() == "BB" || strTagID == "FFFFFFFFFFFFFFFFFFFFFFFE")
        //                                {
        //                                    okinsert = true;
        //                                }
        //                                else
        //                                {
        //                                    okinsert = false;
        //                                }

        //                                if (okinsert == true)
        //                                {
        //                                    if (CDBSPMethod == null)
        //                                    {
        //                                        CDBSPMethod = new CDBSPMethed();
        //                                    }
        //                                    this.DisplayByTagID(strTagID, CDBSPMethod);
        //                                }
        //                            }
        //                        }

        //                        trTagLife.RemoveBefore(dtCurrentTime);
        //                    }
        //                    catch (Exception ex)
        //                    {
        //                        LogHandler.LogDebugMessage(this.GetType(), "Timer2", ex);
        //                    }
        //                    finally
        //                    {
        //                        // ********************************************************************
        //                        // Date : 10/01/2007
        //                        // Description : It is used to make sure that the execution time of
        //                        // procedure is within specific interval
        //                        TimeSpan diff = DateTime.Now.Subtract(dtCurrentTime);

        //                        if ((int)((double)this.intTimer2Interval - diff.TotalMilliseconds) > 0)
        //                        {
        //                            try
        //                            {
        //                                this.timer2.Interval = (int)((double)this.intTimer2Interval - diff.TotalMilliseconds) + 1;
        //                            }
        //                            catch (Exception ex)
        //                            {
        //                                LogHandler.LogDebugMessage(this.GetType(), "timer2_Tick", ex);
        //                            }
        //                        }
        //                        else
        //                        {
        //                            this.timer2.Interval = 1;
        //                        }

        //                        if (CDBSPMethod != null)
        //                        {
        //                            try
        //                            {
        //                                CDBSPMethod.Disconnect();
        //                                CDBSPMethod = null;
        //                            }

        //                            catch (Exception ex)
        //                            {
        //                                LogHandler.LogDebugMessage(this.GetType(), "timer2_Tick", ex);
        //                            }
        //                        }
        //                        // ********************************************************************
        //                    }
        //                }
        //            }
        //        }
        //    }
        //}
        private void cmdDelete_Click(object sender, System.EventArgs e)
        {
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04

            try
            {
                if (this.DtSelectItem.Rows.Count > 0)
                {
                    DataRowCollection rc = this.DtSelectItem.Rows;
                    int selectDel = this.DgSelect.CurrentRowIndex;
                    rc[selectDel].Delete();
                    this.DtSelectItem.AcceptChanges();
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void SetGridLayout()
        {
            this.DgResult.TableStyles.Clear();
            DataGridTableStyle ts1 = new DataGridTableStyle();
            ts1.MappingName = this.dtTagLife.TableName;
            // Set other properties.
            ts1.AlternatingBackColor = Color.LightGray;

            /* Add a GridColumnStyle and set its MappingName
                to the name of a DataColumn in the DataTable.
                Set the HeaderText and Width properties. */
            DataGridColumnStyle Col1 = new DataGridTextBoxColumn();
            Col1.MappingName = "TagID";
            Col1.HeaderText = "TagID";
            Col1.Width = 200;
            Col1.ReadOnly = true;
            ts1.GridColumnStyles.Add(Col1);

            DataGridColumnStyle Col2 = new DataGridTextBoxColumn();
            Col2.MappingName = "Counter";
            Col2.HeaderText = "Counter";
            Col2.Width = 20;
            Col2.ReadOnly = true;
            ts1.GridColumnStyles.Add(Col2);

            DataGridColumnStyle Col3 = new DataGridTextBoxColumn();
            Col3.MappingName = "AntSeq";
            Col3.HeaderText = "Ant Seq";
            Col3.Width = 40;
            Col3.ReadOnly = true;
            ts1.GridColumnStyles.Add(Col3);

            DataGridColumnStyle Col4 = new DataGridTextBoxColumn();
            Col4.MappingName = "StartTime";
            Col4.HeaderText = "Start Time";
            Col4.Width = 170;
            Col4.ReadOnly = true;
            ts1.GridColumnStyles.Add(Col4);

            DataGridColumnStyle cDate =
                new DataGridTextBoxColumn();
            cDate.MappingName = "EndTime";
            cDate.HeaderText = "End Time";
            cDate.Width = 170;
            cDate.ReadOnly = true;
            ts1.GridColumnStyles.Add(cDate);

            DataGridColumnStyle Col6 =
                new DataGridTextBoxColumn();
            Col6.MappingName = "ReaderIP";
            Col6.HeaderText = "Reader IP";
            Col6.Width = 90;
            Col6.ReadOnly = true;
            ts1.GridColumnStyles.Add(Col6);

            /* Add the DataGridTableStyle instances to
                the GridTableStylesCollection. */
            this.DgResult.TableStyles.Add(ts1);
            this.PubMethod.SetDataGridProperty(this.DgResult);
            this.PubMethod.SetDataGridProperty(this.DgSelect);
        }

        private void timer3_Tick(object sender, System.EventArgs e)
        {
            if (this.lblconnecting.Text != "Ready")
            {
                if (this.labelcounter <= 5)
                {
                    this.lblconnecting.Text += ".";
                    this.lblcollectstate.Text += ".";//20/1/2007 Eric
                    this.labelcounter++;
                }
                else
                {
                    if (this.boolLogin == true && this.cboAction.SelectedItem.ToString().Trim().Equals("writetag"))
                    {
                        this.lblconnecting.Text = "Writting";
                        this.lblcollectstate.Text = "Writting";//20/1/2007 Eric
                    }
                    else if (this.boolLogin == true && !this.cboAction.SelectedItem.ToString().Trim().Equals("writetag"))
                    {
                        this.lblconnecting.Text = "讀取標簽中";
                        this.lblcollectstate.Text = "讀取標簽中";//20/1/2007 Eric

                        this.lblcollectstate.ForeColor = System.Drawing.Color.Blue;//Add By XKH 2009-04-01
                    }
                    this.labelcounter = 0;
                }

                //if (this.lblLocationCount < 20)
                //{
                //    this.lblcollectstate.Location = new System.Drawing.Point(898 - this.lblLocationCount*25, 704);
                //    this.lblLocationCount++;
                //}
                //else
                //{
                //    this.lblcollectstate.Location = new System.Drawing.Point(898, 704);
                //    this.lblLocationCount = 0;
                //}

            }
        }

        private void bExitButton1_Click_1(object sender, System.EventArgs e)
        {
            this.Close();
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04
        }
        private void ExitApplication()
        {
            try
            {
                this.ClosConnection();
                Application.Exit();
            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }
        }

        private void bImageButton1_Click(object sender, System.EventArgs e)
        {
            string tempreaderip = "", tempaction = "";
            if (this.cboReaderIP.Items.Count > 0)
            {
                tempreaderip = this.cboReaderIP.SelectedItem.ToString().Trim();
            }
            if (this.cboAction.Items.Count > 0)
            {
                tempaction = this.cboAction.SelectedItem.ToString().Trim();
            }
            this.GetParaFromDB();
            try
            {
                GetProfileInfo = new GetProfileInfo();
                string[] strclientallaction = this.GetProfileInfo.GetClientAction(GetCurrentIP.GetLocalIP());
                this.cboAction.DataSource = null;
                this.cboAction.Items.Clear();
                this.cboReaderIP.SelectedItem = tempreaderip;
                for (int i = 0; i < strclientallaction.Length; i++)
                {
                    this.cboAction.Items.Add(strclientallaction.GetValue(i).ToString().Trim());
                    if (strclientallaction.GetValue(i).ToString().Trim().Equals(tempaction))
                    {
                        this.cboAction.SelectedItem = tempaction;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        private void RFIDTestClient_Closed(object sender, System.EventArgs e)
        {
            this.ExitApplication();
        }

        private void RFIDTestClient_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            string message = "Are you sure close and disconnect to avanti RFIDnet middleware client?";
            string caption = "Info Dialog";
            MessageBoxButtons buttons = MessageBoxButtons.YesNo;
            DialogResult result;

            result = MessageBox.Show(this, message, caption, buttons,
                MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            if (result == DialogResult.No)
            {
                e.Cancel = true;
            }
        }
        public void OnUnhandledException(object sender, UnhandledExceptionEventArgs args)
        {
            //9/1,06 Emily
            Exception e = (Exception)args.ExceptionObject;

            Console.WriteLine("RFIDClient " + e.Message);

            LogHandler.LogDebugMessage(this.GetType(), "OnUnhandledException", e);

        }

        private void cboAction_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04
            //16/1,06 Emily
            string tempaction = this.cboAction.SelectedItem.ToString().Trim();
            if (this.lblconnecting.Text != "Ready" && this.lblconnecting.Text != "Write Tag Successfully")
            {
                if (!tempaction.Equals("gettaglist"))
                {
                    this.cboAction.SelectedItem = "gettaglist";
                    MessageBox.Show("Cannot perform any action command while another action is requesting");
                }
                else
                {
                    this.CheckAction();
                }
            }
            else
            {
                this.CheckAction();
            }
        }
        private void CheckAction()
        {
            if (this.cboAction.SelectedItem.ToString().Trim().ToUpper().Equals("WRITETAG") && this.boolLogin == true)
            {
                this.cmdstart.Enabled = false;
                this.DtSelectItem.Clear();
            }
            else if (this.cboAction.SelectedItem.ToString().Trim().ToUpper().Equals("GETTAGLIST") && this.boolLogin == true)
            {
                this.cmdstart.Enabled = true;
                this.cmdadd.Enabled = true;
            }
        }
        private void menuItem1_Click(object sender, System.EventArgs e)
        {
            this.bTextBox_M1.Clear();
        }

        private void cboReaderIP_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            blnClickTabPage2 = true;//Add By XueKeHuang 2008/07/04

            //18/1,06 Emily get rfattenuation
            if (!this.cboReaderIP.SelectedItem.ToString().Trim().Equals(""))
            {
                this.GetReaderInfo();
                //get reader parameter    
                this.GetFilteringPara(this.FilteringParaHT);
                this.GetReadCountPara(this.ReadCountHT);
                this.GetWakeCountPara(this.WakeUpHT);
            }
            else
            {
            }
        }
        private void GetReaderInfo()
        {
            try
            {
                int intcount = 0;
                this.DBMethod = new DBMethod();
                this.DBMethod.Connect();
                System.Data.SqlClient.SqlCommand RetriveReaderInfoCommand;
                System.Data.SqlClient.SqlDataReader RetriveReaderInfoReader;
                RetriveReaderInfoCommand = new System.Data.SqlClient.SqlCommand();
                RetriveReaderInfoCommand.CommandText = "SELECT ReaderIP,Attribute,Value FROM  ReaderProfile_Attribute where ReaderIP =@ReaderIP AND (Attribute = 'rfattenuation' OR Attribute = 'progrfattenuation') ORDER BY Attribute DESC";
                RetriveReaderInfoCommand.Parameters.Add("@ReaderIP", System.Data.SqlDbType.VarChar);
                RetriveReaderInfoCommand.Parameters["@ReaderIP"].Value = this.cboReaderIP.SelectedItem.ToString().Trim();
                RetriveReaderInfoCommand.Connection = this.DBMethod.GetConn();
                RetriveReaderInfoReader = RetriveReaderInfoCommand.ExecuteReader();
                while (RetriveReaderInfoReader.Read())
                {
                    intcount = intcount + 1;
                    if (intcount == 1)
                    {
                        this.txtrfattenuation.Text = RetriveReaderInfoReader.GetString(2).Trim();
                    }
                    else if (intcount == 2)
                    {
                        this.txtwritetagAtt.Text = RetriveReaderInfoReader.GetString(2).Trim();
                    }
                }
                RetriveReaderInfoReader.Close();
            }
            catch (Exception ex)
            {
                this.DBMethod.Disconnect();
                Console.WriteLine(ex.Message);
            }
            finally
            {
                this.DBMethod.Disconnect();
            }
        }

        public void GetFilteringPara(Hashtable myList)
        {
            IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
            Console.WriteLine("/t-KEY-/t-VALUE-");
            while (myEnumerator.MoveNext())
                if (myEnumerator.Key.Equals(this.cboReaderIP.SelectedItem.ToString().Trim()))
                {
                    this.intFilteringParameter = Convert.ToInt16(myEnumerator.Value);
                    Console.WriteLine("/t{0}:/t{1}", myEnumerator.Key, myEnumerator.Value);
                }
            this.txtTimeOut.Text = this.intFilteringParameter.ToString();
            Console.WriteLine();
        }
        public void GetReadCountPara(Hashtable myList)
        {
            IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
            Console.WriteLine("/t-KEY-/t-VALUE-");
            while (myEnumerator.MoveNext())
                if (myEnumerator.Key.Equals(this.cboReaderIP.SelectedItem.ToString().Trim()))
                {
                    this.intReadingFrequency = Convert.ToInt16(myEnumerator.Value);
                    Console.WriteLine("/t{0}:/t{1}", myEnumerator.Key, myEnumerator.Value);
                }
            this.txtReadingFreq.Text = this.intReadingFrequency.ToString();
            Console.WriteLine();
        }
        public void GetWakeCountPara(Hashtable myList)
        {
            IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
            Console.WriteLine("/t-KEY-/t-VALUE-");
            while (myEnumerator.MoveNext())
                if (myEnumerator.Key.Equals(this.cboReaderIP.SelectedItem.ToString().Trim()))
                {
                    this.intWakeUpCount = Convert.ToInt16(myEnumerator.Value);
                    Console.WriteLine("/t{0}:/t{1}", myEnumerator.Key, myEnumerator.Value);
                }
            this.txtWakeUPCount.Text = this.intWakeUpCount.ToString();
            Console.WriteLine();
        }
        private void RFIDTestClient_Resize(object sender, System.EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
            {
                this.Hide();
            }

        }

        private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
            {
                this.Show();
                WindowState = FormWindowState.Normal;
            }
            else
            {
                this.Hide();
                WindowState = FormWindowState.Minimized;
            }

        }

        private void menuRestore_Click(object sender, System.EventArgs e)
        {
            this.Show();
            WindowState = FormWindowState.Normal;
        }

        private void menuClose_Click(object sender, System.EventArgs e)
        {
            this.Close();
        }


        // Method :                       CheckExistingTagInfo
        // Description :                  It is used to detect whether the warning message need to be displayed.
        //                                      If not, display according to the stored procedure
        // Input :                            null
        // Output :                         bool (If warning message is displayed, true value is returned. Otherwise,
        //                                      return false)
        private bool CheckExistingTagInfo()
        {
            DataTable dttempjobNo = new DataTable();
            bool isDisplayWarning = false;
            try
            {
                int intMultiTag = this.GetMultiTagTime() * 1000 * 60;
                int intSingleTag = this.GetSingleTagTime() * 1000 * 60;
                int intFilter = this.GetFilteringInterval() * 1000 * 2;   //10/01/2007
                //int intFilter = 5000;                                   //10/01/2007


                //DataView dv = this.dtjobNo.DefaultView;
                DataView dv = this.JobNoList.JobList().DefaultView;


                dttempjobNo.Columns.Add(new DataColumn("JobNo", typeof(string)));
                dttempjobNo.Columns.Add(new DataColumn("DiscoveryTime", typeof(DateTime)));
                dttempjobNo.Columns.Add(new DataColumn("LastSeenTime", typeof(DateTime)));
                dttempjobNo.Columns.Add(new DataColumn("Interface", typeof(int)));
                dttempjobNo.Columns.Add(new DataColumn("CartonQty", typeof(int)));
                dttempjobNo.Columns.Add(new DataColumn("BackColor", typeof(int)));
                dttempjobNo.Columns.Add(new DataColumn("AlertMSG", typeof(string)));
                dttempjobNo.Columns.Add(new DataColumn("TagNo", typeof(string)));
                dttempjobNo.Columns.Add(new DataColumn("InOutStatus", typeof(string)));
                dttempjobNo.Columns.Add(new DataColumn("PilotLampColor", typeof(int)));
                dttempjobNo.Columns.Add(new DataColumn("SoundMSG", typeof(int)));
                dttempjobNo.Columns.Add(new DataColumn("Shown", typeof(int)));
                dttempjobNo.Columns.Add(new DataColumn("ShownOrder", typeof(int))); //06/03/2007    Eric

                for (int i = 0; i < dv.Count; i++)
                {
                    #region
                    DateTime ltime = (DateTime)dv[i]["LastSeenTime"];
                    DateTime dtime = (DateTime)dv[i]["DiscoveryTime"];
                    TimeSpan diff = ltime.Subtract(dtime);

                    if ((diff.TotalMilliseconds > (double)intSingleTag))
                    {
                        DataRow dr = dttempjobNo.NewRow();
                        dr[0] = dv[i]["JobNo"];
                        dr[1] = dv[i]["DiscoveryTime"];
                        dr[2] = dv[i]["LastSeenTime"];
                        dr[3] = dv[i]["Interface"];
                        dr[4] = dv[i]["CartonQty"];
                        dr[5] = dv[i]["BackColor"];
                        dr[6] = dv[i]["AlertMSG"];
                        dr[7] = dv[i]["TagNo"];
                        dr[8] = dv[i]["InOutStatus"];
                        dr[9] = dv[i]["PilotLampColor"];
                        dr[10] = dv[i]["SoundMSG"];
                        dr[11] = dv[i]["Shown"];
                        dr[12] = dv[i]["ShownOrder"];
                        dttempjobNo.Rows.Add(dr);
                    }

                    DateTime currentTime = DateTime.Now;
                    diff = currentTime.Subtract(ltime);
                    if ((diff.TotalMilliseconds > (double)intFilter))
                    {
                        this.JobNoList.Delete(dv[i]["TagNo"].ToString());
                        dv.Delete(i);
                        i--;
                    }
                    #endregion
                }

                DataView dvTemp = dttempjobNo.DefaultView;
                if (dvTemp.Count > 0)
                {
                    #region
                    if (!this.isStartCountdownMulitTag)
                    {
                        this.isStartCountdownMulitTag = true;
                        this.dtMultiTagNo = DateTime.Now;
                    }

                    isDisplayWarning = true;
                    //this.intCurrentInterface = 4;

                    //***************Add By XueKeHuang 2008-10-31 小型機台系統***********Begin
                    if (PrexTagNo.ToString().Trim().ToUpper() == "CC")
                        this.ChangeVisibility(0);
                    else //****************************************************************End
                        this.ChangeVisibility(4);

                    this.lblJobNo.Text = "";
                    this.lblCartonQty.Text = "";
                    this.lblStatus.Text = "";
                    this.lblAlertMSG.Text = "警告:請遠離閘門禁區!";

                    //***************Add By XueKeHuang 2008-10-31 小型機台系統***********Begin
                    if (PrexTagNo.ToString().Trim().ToUpper() == "CC")
                        this.lblTagNo.Text = "機台編號:";
                    else //****************************************************************End
                        this.lblTagNo.Text = "卡板編號:";

                    dvTemp.Sort = "DiscoveryTime ASC";

                    DateTime currentTime = DateTime.Now;
                    TimeSpan diff = currentTime.Subtract(this.dtMultiTagNo);

                    if ((diff.TotalMilliseconds > (double)intMultiTag))
                    {
                        for (int i = 0; i < dvTemp.Count; i++)
                        {
                            if (i > 0)
                            {
                                this.lblTagNo.Text += ";";
                            }
                            this.lblTagNo.Text += (string)dvTemp[i]["TagNo"];//By Eric 24/1/2007
                        }
                    }
                    else
                    {
                        this.lblTagNo.Text += (string)dvTemp[0]["TagNo"];
                    }

                    this.isStartCountdown = true;
                    this.dtCountdown = DateTime.Now;

                    #endregion
                }
                else
                {
                    this.isStartCountdownMulitTag = false;
                    this.dtMultiTagNo = DateTime.Now;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            finally
            {
                dttempjobNo.Dispose();

            }
            return isDisplayWarning;
        }


        // Method :                       DisplayNewTagInfo
        // Description :                  If the tag is detected at the first time, it is displayed first.
        //                                      Otherwise, the tag is displayed according to the stored procedure
        // Input :                            null
        // Output :                         null
        private void DisplayNewTagInfo()
        {
            try
            {

                //DataView dv = this.dtjobNo.DefaultView;
                DataView dv = this.JobNoList.JobList().DefaultView;

                dv.RowFilter = "Shown = 0";
                dv.Sort = "ShownOrder ASC,DiscoveryTime ASC";

                if (dv.Count > 0)
                {
                    int intTotal = 0;
                    int intInterface = (int)dv[0]["Interface"];
                    string tagID = (string)dv[0]["TagNo"];
                    //this.intCurrentInterface = intInterface;
                    //this.ChangeVisibility(1);
                    this.ChangeVisibility(intInterface);
                    //dv.RowFilter = "Shown = 0 And Interface = " + intInterface.ToString().Trim();
                    dv.RowFilter = "TagNo = '" + tagID + "' ";
                    this.lblAlertMSG.Text = (string)dv[0]["AlertMSG"];

                    // ********** Add By XueKeHuang 2008-10-31 **************************BEGIN
                    if (PrexTagNo.ToString().Trim().ToUpper() == "CC")
                        this.lblTagNo.Text = "機台編號:";
                    else // *************************************************************END
                        this.lblTagNo.Text = "卡板編號:";

                    for (int i = 0; i < dv.Count; i++)
                    {
                        if (i > 0)
                        {
                            this.lblTagNo.Text += ";";
                        }
                        this.lblTagNo.Text += (string)dv[i]["TagNo"];//by Eric 24/1/2007
                    }

                    this.lblStatus.Text = (string)dv[0]["InOutStatus"];

                    if (intInterface == 2)
                    {
                        ArrayList jobList = new ArrayList();
                        bool isFind = false;
                        for (int i = 0; i < dv.Count; i++)
                        {
                            intTotal += (int)dv[i]["CartonQty"];
                            for (int j = 0; j < jobList.Count; j++)
                            {
                                string strJobNo = (string)jobList[j];
                                if (strJobNo.Equals((string)dv[i]["JobNo"]))
                                {
                                    isFind = true;
                                    break;
                                }
                            }
                            if (!isFind)
                            {
                                jobList.Add((string)dv[i]["JobNo"]);
                            }
                        }
                        this.lblJobNo.Text = "Job #:";
                        for (int i = 0; i < jobList.Count; i++)
                        {
                            if (i > 0)
                            {
                                this.lblJobNo.Text += ";";
                            }
                            this.lblJobNo.Text += (string)jobList[i];
                        }
                        this.lblCartonQty.Text = "卡板箱數:" + intTotal.ToString().Trim();

                        //dv[0]["ShownOrder"] = (int)dv[0]["ShownOrder"] + 1;
                        //dv[0]["Shown"] = 1;


                        //dv.RowFilter = "";
                    }
                    else if (intInterface == 3)
                    {
                        this.lblJobNo.Text = "";
                        this.lblCartonQty.Text = "";


                        //dv[0]["ShownOrder"] = (int)dv[0]["ShownOrder"] + 1;
                        //dv[0]["Shown"] = 1;


                        //dv.RowFilter = "";

                    }

                    else if (intInterface == 5)
                    {
                        ArrayList jobList = new ArrayList();
                        bool isFind = false;
                        for (int i = 0; i < dv.Count; i++)
                        {
                            intTotal += (int)dv[i]["CartonQty"];
                            for (int j = 0; j < jobList.Count; j++)
                            {
                                string strJobNo = (string)jobList[j];
                                if (strJobNo.Equals((string)dv[i]["JobNo"]))
                                {
                                    isFind = true;
                                    break;
                                }
                            }
                            if (!isFind)
                            {
                                jobList.Add((string)dv[i]["JobNo"]);
                            }
                        }
                        this.lblJobNo.Text = "Job #:";
                        for (int i = 0; i < jobList.Count; i++)
                        {
                            if (i > 0)
                            {
                                this.lblJobNo.Text += ";";
                            }
                            this.lblJobNo.Text += (string)jobList[i];
                        }
                        this.lblCartonQty.Text = "卡板箱數:" + intTotal.ToString().Trim();

                        //dv[0]["ShownOrder"] = (int)dv[0]["ShownOrder"] + 1;
                        //dv[0]["Shown"] = 1;

                        //dv.RowFilter = "";
                    }
                    else
                    {
                        //this.lblAlertMSG.Text = (string)dv[0]["AlertMSG"];
                        //this.lblTagNo.Text = this.ChangeTagNo (((string)dv[0]["TagNo"]));//by Eric 24/1/2007
                        // this.lblStatus.Text = "";
                        this.lblJobNo.Text = "";
                        this.lblCartonQty.Text = "";

                        //dv[0]["ShownOrder"] = (int)dv[0]["ShownOrder"] + 1;
                        //dv[0]["Shown"] = 1;

                    }
                    this.JobNoList.Show(dv[0]["TagNo"].ToString());
                }
                //dv.RowFilter = "";
            }
            catch (Exception ex)
            {
                LogHandler.LogDebugMessage(this.GetType(), "DisplayNewTagInfo", ex);
            }
        }

        // Method :                       CountdownTimer_Tick
        // Description :                  It is used to countdown when to return back to main interface
        // Input :                            default
        // Output :                         null
        private void CountdownTimer_Tick(object sender, EventArgs e)
        {
            // Modified
            // Description :    Return to main interface - Leo Logo interface

            // *****************************************************************
            // Modified at 12/01/2007
            DateTime currentTime = DateTime.Now;        // Modified at 12/01/2007

            try
            {

                HandleTagDisplay();

                //int intCountdownSec = this.GetMainInterfaceInterval() * 1000;

                //if (this.isStartCountdown)
                //{
                //    TimeSpan diff = currentTime.Subtract(this.dtCountdown);

                //    // Variable :       intCountdownSec
                //    // Description :    It is the time to return to main interface
                //    //                  And also reset data table to count down again
                //    if ((diff.TotalMilliseconds > (double)intCountdownSec))
                //    {
                //        // Reset the interface to main interface

                //        this.ChangeVisibility(-1);
                //        //this.intCurrentInterface = -1;

                //        this.lblJobNo.Text = "";
                //        this.lblCartonQty.Text = "";
                //        this.lblStatus.Text = "";
                //        this.lblAlertMSG.Text = "";
                //        this.lblTagNo.Text = "";

                //        this.isStartCountdown = false;
                //        this.dtCountdown = DateTime.Now;
                //    }
                //}
                //else
                //{

                //    this.ChangeVisibility(-1);// Modified at 12/01/2007

                //    //DataView dv = this.dtjobNo.DefaultView;
                //    //dv.RowFilter = "";
                //    //if (dv.Count > 0)
                //    if (this.JobNoList.Count>0)
                //    {
                //        if (!this.CheckExistingTagInfo())
                //        {
                //            this.DisplayNewTagInfo();
                //        }

                //        this.isStartCountdown = true;
                //        this.dtCountdown = DateTime.Now;
                //    }

                //}
            }
            catch (Exception ex)
            {
                LogHandler.LogDebugMessage(this.GetType(), "CountdownTimer_Tick", ex);
            }
            finally
            {
                // ********************************************************************
                // Date : 12/01/2007
                // Description : It is used to make sure that the execution time of
                // procedure is within specific interval
                // intCountdownInterval - original time interval of CountdownTimer
                TimeSpan diff = DateTime.Now.Subtract(currentTime);

                if (((double)this.intCountdownInterval - diff.TotalMilliseconds) > 0)
                {
                    try
                    {
                        this.CountdownTimer.Interval = (int)((double)this.intCountdownInterval - diff.TotalMilliseconds) + 1;
                    }
                    catch (Exception ex)
                    {
                        LogHandler.LogDebugMessage(this.GetType(), "CountdownTimer", ex);
                    }
                }
                else
                {
                    this.CountdownTimer.Interval = 1;
                }

                // ********************************************************************
            }
        }


        // ***********************************************************************************
        // Author:Eric
        // Date : 18/01/2007
        // Description : AutoLogin
        //************************************************************************************
        private void AutoLogin()
        {
            try
            {
                this.timer4.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        private void timer4_Tick(object sender, EventArgs e)
        {
            try
            {
                if (this.DtSelectItem.Rows.Count < 1)
                {
                    this.commandAdd();
                }

                if (this.boolLogin == true && this.DtSelectItem.Rows.Count > 0)
                {
                    this.StartReadTag();
                    this.timer4.Stop();
                    this.timer4.Dispose();

                }
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.ToString());
            }

        }
        // ***************************************************************************************

        // *********************************************************************
        // Date : 10/01/2007
        // Description : Check whether the configuration tag page is displayed
        private void tabControl1_KeyDown(object sender, KeyEventArgs e)
        {
            //Add By XueKeHuang 2008/07/04 Begin
            if (this.tabControl1.SelectedIndex == 1)
            {
                blnClickTabPage2 = true;
            }
            //End


            //if (e.KeyCode == Keys.F1)
            //{
            //    if (!this.tabControl1.TabPages.Contains(this.tabPage2))
            //    {
            //        AdminLogin login = new AdminLogin();
            //        login.ShowDialog(this);
            //        if (login.LoginSuccessful == true)
            //        {
            //            this.tabControl1.TabPages.Add(this.tabPage2);

            //        }
            //    }
            //    else
            //    {
            //        this.tabControl1.TabPages.Remove(this.tabPage2);
            //    }
            //}
        }

        private void CountdownTimer_Tick_1(object sender, EventArgs e)
        {

        }

        //gary added
        private void tabControl1_TabIndexChanged(object sender, EventArgs e)
        {
            AdminLogin login = new AdminLogin();
            login.ShowDialog(this);

            if (login.LoginSuccessful == true)
            {
                this.tabControl1.TabPages.Add(this.tabPage2);

            }
        }

        //Add By XueKeHuang 2008/07/04 Begin
        private void timer5_Tick(object sender, EventArgs e)
        {
            if (this.blnGotoTabPage2 == true)
            {
                if (this.blnClickTabPage2 == true)
                {
                    CountTimeValue = 0;
                    blnClickTabPage2 = false;
                }
                else
                {

                }
                int CompareCountTimeValue = 0;
                CountTimeValue += 1;
                CompareCountTimeValue = CountTimeValue;

                int testTimeValue;//for test
                testTimeValue = 601 - CountTimeValue;//for test
                this.lbl1.Text = "離退出設置版面時間還有" + testTimeValue.ToString() + "秒";//for test

                if (CompareCountTimeValue == 600)
                {
                    this.tabPage1.Show();
                    this.tabControl1.SelectedIndex = 0;
                    this.timer5.Stop();
                    this.timer5.Dispose();
                    blnClickTabPage2 = false;
                    CountTimeValue = 0;
                }
            }

            else
            {

            }
        }

        //以下事件被觸發時記錄的時間值將變0
        private void tabPage2_Click(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void cbDisplayResult_Click(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void cbDisplayResult2_Click(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void cboAction_Click(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void cboServerIP_SelectedIndexChanged(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void cboServerIP_Click(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void cboMode_Click(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void cboMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void txtport_MouseClick(object sender, MouseEventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void txtAntSeq_MouseClick(object sender, MouseEventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void bTextBox_M1_MouseClick(object sender, MouseEventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void DgResult_MouseClick(object sender, MouseEventArgs e)
        {
            blnClickTabPage2 = true;
        }

        private void DgSelect_MouseClick(object sender, MouseEventArgs e)
        {
            blnClickTabPage2 = true;
        }

 

        //End

 

    }
}

远程文件系统客户端源码, 超过7000行C++源代码, 其中包含RF32c.dll动态库整个工程源码, 源代码文件清单如下: \RFClient\unit_rc\CmdQueue.cpp \RFClient\unit_rc\CmdQueue.h \RFClient\unit_rc\RCClient.h \RFClient\unit_rc\RCClientObj.cpp \RFClient\unit_rc\RCClientObj.h \RFClient\units\RFCenter.cpp \RFClient\units\RFCenter.h \RFClient\units\RFCExports.cpp \RFClient\units\RFCExports.h \RFClient\units\RFCFileObj.cpp \RFClient\units\RFCFileObj.h \RFClient\units\RFCFindObj.cpp \RFClient\units\RFCFindObj.h \RFClient\units\RFConnObj.cpp \RFClient\units\RFConnObj.h \RFClient\units\RFCUtils.cpp \RFClient\units\RFCUtils.h 接口定义如下: // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 接口相关函数 */ // 接口初始化/释放函数 void __stdcall RFCInitialize(); void __stdcall RFCUninitialize(); // 接口版本信息, 格式: "x.x.x.x (build yyyy.mm.dd)" // AVersion 返回版本号, 如: 0x0708090A 表示 7.8.9.10 char* __stdcall RFCGetVersion(long* AVersion); // 取当前操作的最后错误码(注: 用于 RFConnCreate, RFCFindFirst 和 RFCFileCreate) long __stdcall RFCGetLastError(); // 接口属性操作 long __stdcall RFCGetInt(long Attrib, long* AValue); long __stdcall RFCGetStr(long Attrib, char* AValue, long* ALen); long __stdcall RFCSetInt(long Attrib, long AValue); long __stdcall RFCSetStr(long Attrib, const char* AValue, long ALen); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 连接的相关函数 */ // 连接创建/释放 void* __stdcall RFConnCreate(const char* AHost, long APort, const char* APassword); void __stdcall RFConnFree(void* AConnObj); // 连接打开/关闭 long __stdcall RFConnOpen(void* AConnObj); void __stdcall RFConnClose(void* AConnObj); // 连接属性操作 long __stdcall RFConnGetInt(void* AConnObj, long Attrib, long* AValue); long __stdcall RFConnGetStr(void* AConnObj, long Attrib, char* AValue, long* ALen); long __stdcall RFConnSetInt(void* AConnObj, long Attrib, long AValue); long __stdcall RFConnSetStr(void* AConnObj, long Attrib, const char* AValue, long ALen); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 文件/目录操作的相关函数 */ // 读取/设置文件属性 long __stdcall RFCGetFileAttr(void* AConnObj, const char* AFileName, long* Attrib); long __stdcall RFCSetFileAttr(void* AConnObj, const char* AFileName, long Attrib); // 文件存在/删除/移动文件或目录 long __stdcall RFCFileExisted(void* AConnObj, const char* AFileName); long __stdcall RFCDeleteFile(void* AConnObj, const char* AFileName); long __stdcall RFCMoveFile(void* AConnObj, const char* AOldName, const char* ANewName); // 目录存在/创建/删除 long __stdcall RFCDirExisted(void* AConnObj, const char* APathName); long __stdcall RFCCreateDir(void* AConnObj, const char* APathName, bool AForced = false); long __stdcall RFCRemoveDir(void* AConnObj, const char* APathName, bool AForced = false); // 磁盘操作相关函数 long __stdcall RFCDriveType(void* AConnObj, const char* ADrive, long* AType); long __stdcall RFCDiskSpace(void* AConnObj, const char* APath, __int64* ATotalSpace, __int64* AFreeSpace); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 文件查找的相关函数 */ void* __stdcall RFCFindFirst(void* AConnObj, const char* APath, TRFCFindItem* AItem); long __stdcall RFCFindNext(void* AFindObj, TRFCFindItem* AItem); long __stdcall RFCFindClose(void* AFindObj); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* 文件读写的相关函数 */ // 创建/释放文件对象 void* __stdcall RFCFileCreate(void* AConnObj, const char* AFileName, long AMode, bool ANeedCreate, long AFileAttr); long __stdcall RFCFileFree(void* AFile); // 读写数据 long __stdcall RFCFileRead(void* AFile, void* ABuffer, long ASize); long __stdcall RFCFileWrite(void* AFile, const void* ABuffer, long ASize); // 文件定位/清除文件缓存/设置文件末尾 long __stdcall RFCFileSeek(void* AFile, long* AOffset, long AOrigin); long __stdcall RFCFileSeek64(void* AFile, __int64* AOffset, long AOrigin); long __stdcall RFCFileFlush(void* AFile); long __stdcall RFCFileSetEOF(void* AFile); // 读取文件信息 long __stdcall RFCFileGetInfo(void* AFile, TRFCFileInfo* AInfo); long __stdcall RFCFileGetSize(void* AFile, __int64* ASize); // 读取/设置文件时间 long __stdcall RFCFileGetTime(void* AFile, double* ACreateTime, double* AModifyTime); long __stdcall RFCFileSetTime(void* AFile, const double* ACreateTime, const double* AModifyTime);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值