Пример #1
0
        private void AddWebPageBtn_Click(object sender, EventArgs e)
        {
            string url = AddWebPageTxb.Text;

            List <TargetPageItem> pageList = DownloadProcesser.PageList;

            if (string.IsNullOrWhiteSpace(url))
            {
                MessageBox.Show("不能添加空地址", "空地址", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (pageList.FirstOrDefault(p => p.Url == url) != null)
            {
                MessageBox.Show("该页面已被添加过", "重复添加", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            OpenMask();

            try
            {
                DownloadProcesser.AddPage(url);
                AddWebPageTxb.Text = string.Empty;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            RefreshListView();

            CloseMask();
        }
Пример #2
0
        private void StartDownloadBtn_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.OutputFolderTxb.Text))
            {
                this.OutputFolderTxb.Text = DownloadProcesser.OutputFolderPath;
            }

            if (!System.IO.Directory.Exists(this.OutputFolderTxb.Text))
            {
                if (MessageBox.Show("路径文件夹不存在,是否创建?", "创建目录", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    System.IO.Directory.CreateDirectory(this.OutputFolderTxb.Text);
                }
            }

            DownloadProcesser.Start();
        }
Пример #3
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     DownloadProcesser.CloseDriver();
 }