void Spider_DownloadFinish(int count)
        {
            DFHandler h = c =>
            {
                beginDownload.Enabled = true;
                beginDownload.Text    = "开始爬图";
                stopDownload.Enabled  = false;
                MessageBox.Show("完成爬图: " + c.ToString() + "个");
            };

            this.Invoke(h, count);
        }
Exemple #2
0
        void Spider_DownloadFinish(int count)
        {
            DFHandler h = c =>
            {
                _spider.Abort();
                btnDownload.IsEnabled = true;
                btnDownload.Content   = "Download";
                btnStop.IsEnabled     = false;
                MessageBox.Show("Finished " + c.ToString());
            };

            Dispatcher.Invoke(h, count);
        }
        void Spider_DownloadFinish()
        {
            DFHandler h = () =>
            {
                _spider.Abort();
                btnDownload.IsEnabled = true;
                btnDownload.Content   = "Download";
                btnStop.IsEnabled     = false;
                MessageBox.Show("Finished.");
            };

            Dispatcher.Invoke(h);
        }
Exemple #4
0
        /// <summary>
        /// 下载完成执行的委托方法
        /// </summary>
        /// <param name="count"></param>
        private void Spider_DownloadFinish(int count)
        {
            //DFHandler是一个委托,委托里面封装需要执行的操作,然后调用Dispatcher.Invoke()执行委托
            DFHandler handler = h =>
            {
                spider.Abort();
                btnDownload.IsEnabled = true;
                btnDownload.Content   = "Download";
                btnStop.IsEnabled     = false;
                MessageBox.Show($"Finished {h.ToString()}");
            };

            Dispatcher.Invoke(handler, count);
        }