Exemple #1
0
 public Worker(string InputFilePath, string DownloadDir, Action <string> SendMsg, SearchType Type, InputParam Param, int CrawlerDelay)
 {
     downloadDir   = DownloadDir;
     inputFilePath = InputFilePath;
     sendMsg       = SendMsg;
     searchType    = Type;
     param         = Param;
     crawlerDelay  = CrawlerDelay;
 }
Exemple #2
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            sendMsg("請先選擇檔案");
            string filePath = selectFile();

            if (filePath != string.Empty)
            {
                sendMsg($"已選擇檔案: {filePath}");
            }
            else
            {
                sendMsg("取消操作");
                return;
            }

            sendMsg("請選擇下載路徑");
            string downloadPath = selectPath();

            if (downloadPath != string.Empty)
            {
                sendMsg($"已選擇下載路徑: {downloadPath}");
            }
            else
            {
                sendMsg("取消操作");
                return;
            }

            InputParam param = new InputParam
            {
                WSName         = tbWSName.Text,
                CodeColumnName = tbCodeCol.Text,
                EIDColumnName  = tbEIDCol.Text
            };

            worker = new Worker(filePath, downloadPath, sendMsg, (EID.Checked) ? SearchType.EID : SearchType.REFEID, param, (int)nudDelay.Value);
            try
            {
                worker.Download();
            }
            catch (Exception ex)
            {
                sendMsg($"錯誤: {ex.Message}");
            }
        }