Пример #1
0
        private void btnxImMatchInfo_Click(object sender, EventArgs e)
        {
            string strImportPath = tbImportPath.Text;
            string strPort       = tbTcpPort.Text == "" ? "2102" : tbTcpPort.Text;

            if (strImportPath == "")
            {
                DevComponents.DotNetBar.MessageBoxEx.Show("Please select an import path first!");
                return;
            }
            if (m_tsTTconfig.ImportType == "1")
            {
                if (m_exchangeFile == null)
                {
                    m_exchangeFile = TSDataExchangeTT_File.GetDataExchangeTT_File(BDCommon.g_adoDataBase.strConnection, strImportPath);
                }
            }
            else
            {
                if (m_exchangeTcp == null)
                {
                    m_exchangeTcp = TSDataExchangeTT_TCP.GetDataExchangeTT_TCP(BDCommon.g_adoDataBase.strConnection, Convert.ToInt32(strPort));
                }
            }
            frmImportMatchInfo frm = new frmImportMatchInfo(strImportPath, XmlTypeEnum.XmlTypeMatchInfo);

            frm.ShowDialog();
        }
Пример #2
0
        private void btnAutoImport_Click(object sender, EventArgs e)
        {
            string btnText = btnAutoImport.Text;

            if (btnText == "StartAutoImport")
            {
                if (tbImportPath.Text == "")
                {
                    MessageBox.Show("select import path first!");
                    return;
                }
                if (!Directory.Exists(tbImportPath.Text))
                {
                    MessageBox.Show("The path is not exist!");
                    tbImportPath.Clear();
                    return;
                }
                m_exchangeFile = TSDataExchangeTT_File.GetDataExchangeTT_File(BDCommon.g_adoDataBase.strConnection, tbImportPath.Text);
                if (!m_exchangeFile.StartMonitor())
                {
                    MessageBox.Show(m_exchangeFile.LastErrMsg);
                    return;
                }
                m_exchangeFile.SetUserStoppedFlag(false);
                if (m_heartTestTimer != null)
                {
                    m_heartTestTimer.Dispose();
                }
                //m_heartTestTimer = new System.Windows.Forms.Timer();
                //m_heartTestTimer.Interval = 4000;
                //m_heartTestTimer.Tick += new EventHandler(heartTestTimer_Tick);
                //m_lastHeartTime = DateTime.Now;
                //m_heartTestTimer.Start();
                AddInfoToHeartBox("Monitor Started!");
                btnAutoImport.Text    = "StopAutoImport";
                btnxImPathSel.Enabled = false;
            }
            else
            {
                if (m_heartTestTimer != null)
                {
                    if (m_heartTestTimer.Enabled)
                    {
                        m_heartTestTimer.Stop();
                    }
                    m_heartTestTimer.Dispose();
                }
                if (m_exchangeFile != null)
                {
                    m_exchangeFile.SetUserStoppedFlag(true);
                    m_exchangeFile.StopMonitor();
                    AddInfoToHeartBox("User stopped!");
                }
                btnAutoImport.Text    = "StartAutoImport";
                btnxImPathSel.Enabled = true;
            }
        }