Exemplo n.º 1
0
        private void Btn_Config_Click(object sender, RoutedEventArgs e)
        {
            FetchImageConfigDialog fetchImageConfigDialog = new FetchImageConfigDialog();
            Point point = this.btn_Config.PointToScreen(new Point(0, 0));

            fetchImageConfigDialog.X = point.X;
            fetchImageConfigDialog.Y = point.Y;
            if (fetchImageConfigDialog.ShowDialog() == true)
            {
                if (fetchImageConfigDialog.cbx_ManualRule.IsChecked == true)
                {
                    globalData.CrawlerConfig.ImageConfig.PageDownRule = 0;

                    if (fetchImageConfigDialog.cbx_url.IsChecked == true)
                    {
                        globalData.CrawlerConfig.ImageConfig.ManualPageDownMethod = 0;
                        globalData.CrawlerConfig.ImageConfig.PageDownUrl          = fetchImageConfigDialog.tbox_url.Text;
                    }
                    else
                    {
                        globalData.CrawlerConfig.ImageConfig.ManualPageDownMethod = 1;
                        globalData.CrawlerConfig.ImageConfig.PageDownPostData     = fetchImageConfigDialog.tbox_postdata.Text;
                    }
                }
                else
                {
                    globalData.CrawlerConfig.ImageConfig.PageDownRule = 1;
                }
            }
        }
Exemplo n.º 2
0
        private void Btn_Config_Click(object sender, RoutedEventArgs e)
        {
            var imageConfig = globalData.CrawlerConfig.ImageConfig;
            FetchImageConfigDialog fetchImageConfigDialog = new FetchImageConfigDialog();

            fetchImageConfigDialog.Init(imageConfig.PageDownRule, imageConfig.PageDownMethod, imageConfig.PageDownUrl, imageConfig.PageDownPostData);
            Point point = this.btn_Config.PointToScreen(new Point(0, 0));

            fetchImageConfigDialog.X = point.X;
            fetchImageConfigDialog.Y = point.Y;
            if (fetchImageConfigDialog.ShowDialog() == true)
            {
                if (fetchImageConfigDialog.cbx_ManualRule.IsChecked == true)
                {
                    imageConfig.PageDownRule = PageDownRuleType.Manual;

                    if (fetchImageConfigDialog.cbx_url.IsChecked == true)
                    {
                        imageConfig.PageDownMethod = PageDownMethodType.Url;
                        imageConfig.PageDownUrl    = fetchImageConfigDialog.tbox_url.Text;
                    }
                    else
                    {
                        imageConfig.PageDownMethod   = PageDownMethodType.Post;
                        imageConfig.PageDownPostData = fetchImageConfigDialog.tbox_postdata.Text;
                    }
                }
                else
                {
                    imageConfig.PageDownRule = PageDownRuleType.Auto;
                }
            }
        }