Ejemplo n.º 1
0
        /// <summary>
        /// 获取输入参数
        /// </summary>
        /// <returns></returns>
        private InputPara GetInputPara()
        {
            InputPara para = InputPara.GetInstance();

            para.Key         = txtKeyWord.Text.Trim();
            para.SaveDirPath = txtOutputPath.Text.Trim();
            para.Url         = txtUrl.Text.Trim();
            return(para);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 百度图片下载
        /// </summary>
        /// <param name="obj"></param>
        private void BaiduDownload(object obj)
        {
            InputPara para = obj as InputPara;

            sd                       = new BaiduDownload();
            sd.SaveDirPath           = para.SaveDirPath;
            sd.Key                   = para.Key;
            sd.ImgDownloadFinish    += bis_ImageDownloadFinish;
            sd.ImgDownloadAllFinish += bis_ImageDownloadAllFinish;
            sd.Download();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 百度下载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnBaiduDownLoad_Click(object sender, RoutedEventArgs e)
 {
     if (CheckIsConnected() && CheckBaiduInputPara())
     {
         BeforeBaiduDownload();
         InputPara para = GetInputPara();
         Thread    th   = new Thread(BaiduDownload);
         th.IsBackground = true;
         th.Start(para);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 爬虫图片下载
        /// </summary>
        /// <param name="obj"></param>
        private void SpiderDownload(object obj)
        {
            InputPara para = obj as InputPara;

            sd                       = new SpiderDownload();
            sd.RootUrl               = para.Url;
            sd.SaveDirPath           = para.SaveDirPath;
            sd.ImgDownloadFinish    += sd_ImgDownloadFinish;
            sd.ImgDownloadAllFinish += sd_ImgDownloadAllFinish;
            sd.Download();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 爬虫下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSpiderDownload_Click(object sender, RoutedEventArgs e)
        {
            if (CheckIsConnected() && CheckSpiderInputPara())
            {
                BeforeSpiderDownload();

                InputPara config = GetInputPara();
                Thread    th     = new Thread(SpiderDownload);
                th.IsBackground = true;
                th.Start(config);
            }
        }
Ejemplo n.º 6
0
        public static InputPara GetInstance()
        {
            if (instance == null)
            {
                lock (_lock)
                {
                    if (instance == null)
                    {
                        instance = new InputPara();
                    }
                }
            }

            return instance;
        }
Ejemplo n.º 7
0
        public static InputPara GetInstance()
        {
            if (instance == null)
            {
                lock (_lock)
                {
                    if (instance == null)
                    {
                        instance = new InputPara();
                    }
                }
            }

            return(instance);
        }