예제 #1
0
        //find div class action_175px_div
        private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //throw new NotImplementedException();

            var doc = new HtmlDocument();

            doc.Load(DataSource.prewww + DataSource.drawings_alison);



            var wefwefwe = doc.DocumentNode.Descendants("div").Where(d =>
                                                                     d.Attributes.Contains("class") && d.Attributes["class"].Value.Contains("action_175px_div")).ToList();

            foreach (var item in wefwefwe)
            {
                var ewfwe = new ImageAndTitle();
                //game inteference
                var fdjkdsf = item.Descendants("a").ToList();
                var eefff   = fdjkdsf[0].Attributes["href"].Value;
                ewfwe.GameUrl = DataSource.interfhome + eefff;

                var imgsdf = item.Descendants("img").ToList();
                var imgwef = imgsdf[0].Attributes["src"].Value;
                ewfwe.ImagPath = imgwef;
                //ewfwe.Image = new BitmapImage(new Uri(ewfwe.ImagPath));

                //var eefjfj = fdjkdsf
                BitmapImage wefwe = new BitmapImage(new Uri(ewfwe.ImagPath));
                //Image1Test.Source = wefwe;

                //if(item.Attributes.cl)
                //get innerText and innerHTML
                ewfwe.Title = item.InnerText.Replace(@"\r\n", "").Replace(@"\", "").Replace(@":", "").Replace(@",", "").Replace("\"", "").Replace("?", "").Trim();;
                //var aaaa = item.
                imageAndTitleList.Add(ewfwe);
                //break;
                SavePhoto(ewfwe);
                await Task.Delay(1000);
            }

            ////var ewfefewf = doc.DocumentNode.Descendants("img").ToList();
            //var fefewwfewfefewf = doc.DocumentNode.Descendants("a").ToList();

            //foreach (var item in fefewwfewfefewf)
            //{
            //    //fefewwfewfefewf.
            //}
        }
예제 #2
0
        public void SavePhoto(ImageAndTitle imagandTitle)
        {
            BitmapImage objImage = new BitmapImage(new Uri(imagandTitle.ImagPath, UriKind.RelativeOrAbsolute));

            objImage.DownloadCompleted += objImage_DownloadCompleted;
        }