Exemple #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (CommonFun.CheckFileExists(txtFilePath.Text.Trim()) == false)
            {
                MessageBox.Show(string.Format("{0}不存在.", txtFilePath));
                return;
            }
            strAccessConnection = string.Format(_deviceElement.ConnectionString, txtFilePath.Text.Trim());

            dataTransferAction = new IVTestDataTransferAction(strAccessConnection);
            dataTransferAction.OnDataTransferFinished += new EventHandler <DataTransferFinishedArgs>(DataTransferFinished);
            int nSecond = 0;

            if (int.TryParse(txtInterval.Text, out nSecond) == true)
            {
                if (nSecond < 3)
                {
                    MessageBox.Show("时间设置不能小于(3)秒");
                    return;
                }
            }
            timer1.Interval = nSecond * 1000;
            timer1.Enabled  = true;
            StartTransfer();
        }